Consensus on goto's into catch blocks

Iain Buclaw ibuclaw at ubuntu.com
Thu Jun 13 10:35:39 PDT 2013


Can someone remind me again what was last agreed when I brought 
this up?

I seem to recall that this should be disallowed as is practically 
always a bug, also, and it skips any initialisation of the 
exception object. (See: http://dlang.org/statement.html - "It is 
illegal for a GotoStatement to be used to skip initializations.")

Current failing test I want to have removed from the test suite.

test/runnable/eh.d:
void test8()
{
   int a;
   goto L2;    // gdc Error: cannot goto into catch block

   try {
       a += 2;
   }
   catch (Exception e) {
       a += 3;
L2: ;
       a += 100;
   }
   assert(a == 100);
}


Thanks
Iain.



More information about the Digitalmars-d mailing list