Bug 16012 – [REG2.070] forward reference with alias this

Status
NEW
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-05-10T21:58:47Z
Last change time
2024-12-13T18:47:43Z
Keywords
pull, rejects-valid
Assigned to
No Owner
Creator
ag0aep6g
Blocks
340
Moved to GitHub: dmd#17755 →

Comments

Comment #0 by ag0aep6g — 2016-05-10T21:58:47Z
This is a reduction of issue 16011. Fixing this possibly also fixes that one, but since this fails with different versions of dmd, there may be something else going on in addition. ---- void emplace(S* chunk) { *chunk = S.init; } struct RefCounted() { struct RefCountedStore { struct Impl { S _payload; } Impl* _store; void initialize() { _store = new Impl; /* line 13 */ emplace(&_store._payload); /* line 14 */ } } RefCountedStore _refCounted; void opAssign(typeof(this) rhs) {} void opAssign(S rhs) {} ref S refCountedPayload() { if (_refCounted._store is null) _refCounted.initialize(); return _refCounted._store._payload; } alias refCountedPayload this; } struct S { int x; RefCounted!() s; } void main() { S s; s.x = 1; s.s.x = 2; s.s.s.x = 3; assert(s.x == 1); assert(s.s.x == 2); assert(s.s.s.x == 3); } ---- 2.069.2: Compiles and passes asserts. 2.070.2, 2.071.0: "test.d(13): Error: struct test.RefCounted!().RefCounted.RefCountedStore.Impl no size yet for forward reference" git master (bc74f4a): "test.d(14): Error: forward reference to (*this._store)._payload"
Comment #1 by ag0aep6g — 2016-05-10T22:02:59Z
Further reduced to two very similar, recently introduced ICEs: issue 16013.
Comment #2 by k.hara.pg — 2016-05-13T20:55:34Z
Comment #3 by robert.schadek — 2024-12-13T18:47:43Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/17755 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB