Reported by %u. ------------ struct S { static int func() { S s; int e; switch( e ) { default: return 0; } } static int[1] ARR = [func() ]; } ---- Assertion failure: '!cases' on line 2741 in file 'statement.c' abnormal program termination It's happening because the CTFE for ARR speculatively runs func(). There's a 'no size yet for forward referenced struct' error because S isn't complete yet. But this happens with errors gagged. The SwitchStatement completes its semantic pass correctly. But, because "S s;" failed, semantic gets run again for func(), without errors gagged this time. SwitchStatement::semantic() detects it's been run twice, and asserts.
*** Issue 6326 has been marked as a duplicate of this issue. ***
D2 fix: https://github.com/D-Programming-Language/dmd/commit/0a927f258e89f92f280c0e855a93ceb05e34a260 Partial D1 fix: https://github.com/D-Programming-Language/dmd/commit/31d6751de3a877c72055a2096a9a9c4a9a25ec9b
D1 fix: https://github.com/D-Programming-Language/dmd/commit/23846aca52ebd21efab36ff32924c5a6cc17c4c0