Bug 24251 – Spurious forward reference error with nested struct

Status
NEW
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2023-11-19T21:55:59Z
Last change time
2024-12-13T19:31:54Z
Assigned to
No Owner
Creator
andy-hanson
Moved to GitHub: dmd#18199 →

Comments

Comment #0 by andy-hanson — 2023-11-19T21:55:59Z
``` struct A { B b; } struct B { struct Inner { C c; } } struct C { A a; } ``` This results in the error: ``` a.d(12): Error: struct `a.A` no size because of forward reference ``` There's no need for this error, since an instance of B doesn't actually contain a C. Just like there is no error in this simpler case: ``` struct A { struct Inner { B b; } } struct B { A a; } ``` I discovered this when chasing a sporadic forward reference error that appeared when changing unrelated code.
Comment #1 by robert.schadek — 2024-12-13T19:31:54Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18199 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB