https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120096
Bug ID: 120096 Summary: d: Side effects not evaluated for array literals on stack Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: d Assignee: ibuclaw at gdcproject dot org Reporter: ibuclaw at gcc dot gnu.org Target Milestone: --- This example fails (requires -fpreview=dip1000) ``` struct S { this(int p) nothrow @nogc @safe { f = p; } int f; } int main() nothrow @nogc @safe { scope S[] sa = [S(1), S(2)]; assert(sa[0].f == 1); assert(sa[1].f == 2); return 0; } ``` The side effects in `[S(1), S(2)]` are lost during code generation.