digitalmars.D.bugs - [Issue 15726] New: forward reference error for circular classes,
- via Digitalmars-d-bugs (43/43) Feb 25 2016 https://issues.dlang.org/show_bug.cgi?id=15726
https://issues.dlang.org/show_bug.cgi?id=15726 Issue ID: 15726 Summary: forward reference error for circular classes, RefCounted Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: erik cruiserhouse.com 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; --
Feb 25 2016