Bug 15726 – [REG2.068.0] forward reference error for circular classes, RefCounted

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-02-26T05:05:46Z
Last change time
2017-11-09T06:22:15Z
Keywords
pull, rejects-valid
Assigned to
No Owner
Creator
Erik Smith

Comments

Comment #0 by erik — 2016-02-26T05:05:46Z
The code below fails to compile with the following error: /usr/local/Cellar/dmd/2.070.1-b1_1/include/dlang/dmd/object.d(2762): Error: struct bug.Statement!int.Statement.Payload no size yet for forward reference It's an issue involving circular struct references and RefCounted (with a reduced version below). Possible related issues: 12000, 14390 The failing PR found via digger: https://github.com/D-Programming-Language/dmd/pull/4457 Here is the failing code: struct RefCounted(T) { struct Impl { T _payload; } Impl* _store; ~this() { destroy(_store._payload); } } struct Connection(T) { alias Statement = .Statement!T; } struct Statement(T) { alias Connection = .Connection!T; struct Payload { Connection con; } RefCounted!Payload Data; } Connection!int x;
Comment #1 by erik — 2016-03-08T00:31:25Z
This bug also occurs in other cases where the types are not directly cross referenced with top level aliases (see example below using same RefCounted as in first example). This is blocking multiple design paths without a workaround. struct Util(C,S) {} struct Connection(T) { alias Util = .Util!(Connection!T, Statement!T); } struct Statement(T) { struct Payload { Connection!T con; } RefCounted!Payload Data; } Connection!int x;
Comment #2 by k.hara.pg — 2016-03-08T15:22:48Z
Comment #3 by github-bugzilla — 2016-03-31T07:05:47Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/ebc83d3c8ef9f16e7aff201757850a9c738650b0 fix Issue 15726 - forward reference error for circular classes, RefCounted https://github.com/D-Programming-Language/dmd/commit/1d8ce9d8d2669693cb59efd8b00e4a6554467079 Merge pull request #5500 from 9rnsr/fix15726 [REG2.068.0] Issue 15726 - forward reference error for circular classes, RefCounted
Comment #4 by github-bugzilla — 2016-10-01T11:45:46Z
Commits pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/ebc83d3c8ef9f16e7aff201757850a9c738650b0 fix Issue 15726 - forward reference error for circular classes, RefCounted https://github.com/dlang/dmd/commit/1d8ce9d8d2669693cb59efd8b00e4a6554467079 Merge pull request #5500 from 9rnsr/fix15726
Comment #5 by github-bugzilla — 2017-03-24T16:11:21Z
Commit pushed to stable at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/f429983efbeb78aa727827ae7d76a728996b4d4d Fix wrong fields.dim value from test13613. This is a regression from fixing issue 15726, which caused gdc to ICE because it actually verifies the contents of the frontend AST are correct.
Comment #6 by github-bugzilla — 2017-04-09T17:57:01Z
Commit pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/f429983efbeb78aa727827ae7d76a728996b4d4d Fix wrong fields.dim value from test13613.
Comment #7 by github-bugzilla — 2017-08-07T13:15:32Z
Commit pushed to newCTFE at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/f429983efbeb78aa727827ae7d76a728996b4d4d Fix wrong fields.dim value from test13613.
Comment #8 by github-bugzilla — 2017-11-09T06:22:15Z
Commit pushed to dmd-cxx at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/7e9205d5185e89ac2248b159bbfdc02a12328f18 Fix backport of Issue 15726 - forward reference error for circular classes