https://issues.dlang.org/show_bug.cgi?id=17646
Issue ID: 17646 Summary: dmd segfaults on missing foreach body in import Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: john.loughran.col...@gmail.com $ cat ut.d int main() { runTests!""; } int runTests(Modules...)() { import reflection; allTestData!Modules; } $ cat reflection.d struct TestData {} const(TestData)[] allTestData(MOD_STRINGS...)() { foreach (i; MOD_STRINGS) } $ gdb -q dmd Reading symbols from dmd...done. (gdb) r -o- ut.d Starting program: dmd -o- ut.d DMD v2.075.0-b4-102-gf189b2d08-dirty DEBUG reflection.d(4): Error: found '}' instead of statement Program received signal SIGSEGV, Segmentation fault. 0x0000000000637b63 in StatementSemanticVisitor::visit(ForeachStatement*) (this=0x7fffffff98d8, fs=0x7ffff6cb22d0) at ddmd/statementsem.d:742 742 st.push(fs._body.syntaxCopy()); (gdb) p fs._body $1 = (ddmd.statement.Statement *) 0x0 For some reason semantic is going ahead despite syntax having failed? --