struct S { ~this() nothrow; } void test() nothrow { goto skip; S r; skip: } error : cannot `goto` into `try` block test() is nothrow, S.~this() is nothrow. There should be no `try` blocks in sight... the message should be about skipping initialisation.
The compiler rewrites things that happen on scope exit (such as destructors) into try-finally blocks. The same happens with scope guards: ``` void main() { goto x; scope(exit) {} x: } ``` See also issue 24300. The solution is probably to add a field to the lowered AST node keeping track of where a try-finally block came from.
Is that efficient? Does that affect optimisation opportunities in any way?