https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100882
Bug ID: 100882 Summary: ICE in gimplify_var_or_parm_decl, at gimplify.c:2755 Product: gcc Version: 9.4.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: d Assignee: ibuclaw at gdcproject dot org Reporter: ibuclaw at gdcproject dot org Target Milestone: --- Reduced test, adapted to make clear what the correct behaviour should be after the ICE is fixed. --- __gshared int counter = 0; struct S { this(int) { counter++; } ~this() { counter++; } } static S s; static this() { s = cast(shared) S(0); assert(counter == 2); } --- Reproducible from gdc-9 onwards.