DMD Segfault on the following sample code: struct A { P p; struct UTpl() { union { P p; } } alias U() = UTpl!(); } alias B = A.U!(); struct C { union D { B b; } } union P { C.D p; } I have not been able to reduce the sample case further and I'm not quite sure what's going on.
Running on older version of DMD tells me it is a regression. 2.066.0 to 2.071.2: Failure with output: onlineapp.d(21): Error: union onlineapp.P no size yet for forward reference
There's certainly an unresolvable circular thing going on here.
It's an infinite loop trying to determine the sizes for: P => D => UTpl => P ... resulting in a stack overflow.
https://github.com/dlang/dmd/pull/9072
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/d2b6fc972aec7b5a518b437f4ec0f8e184d549be fix Issue 19473 - DMD Segfault on circular struct reference https://github.com/dlang/dmd/commit/5aa95b571b473666b9e68dd1cb07c8dd0b008925 Merge pull request #9072 from WalterBright/fix19473 fix Issue 19473 - DMD Segfault on circular struct reference