Following code behaves differently in compile-time and runtime. bool f() { goto L; try { L: // line 7 throw new Exception(""); // line 8 } catch (Exception e) { return true; } return false; } static assert(f()); void main() { f(); } If you compile the code, CTFEing f() will raise compile-time errors: test.d(8): Error: Uncaught CTFE exception object.Exception("") test.d(16): called from here: f() test.d(16): while evaluating: static assert(f()) But, if you mask the static assert, codegen for the function will report a glue-layer error: test.d(7): Error: cannot goto into try block
@MoonlightSentinel updated dlang/dmd pull request #12439 "Use correct scope during statementSemantic on try-block" fixing this issue: - Fix 13815 - Use correct scope during statementSemantic on try-block `sc2` was created but never used (probably a typo). While running the code doesn't cause errors in CTFE it triggers an assert in backend. https://github.com/dlang/dmd/pull/12439
dlang/dmd pull request #12439 "Fix 13815 - Use correct scope during statementSemantic on try-block" was merged into master: - e7eb6efffa1a3c6aa5739ccc5196be4beab7ec15 by MoonlightSentinel: Fix 13815 - Use correct scope during statementSemantic on try-block `sc2` was created but never used (probably a typo). While running the code doesn't cause errors in CTFE it triggers an assert in backend. https://github.com/dlang/dmd/pull/12439