On 09/13/2011 12:27 AM, Iain Buclaw wrote:
I have been merging Phobos that got released with the latest DMD release into
GDC. And couldn't help but notice this nostalgic error I implemented a while 
back:

     std/format.d:1520: Error: cannot goto into catch block


Line of concern in phobos:
https://github.com/D-Programming-Language/phobos/blob/master/std/format.d#L1539

Part of spec which error implements:
http://www.digitalmars.com/d/2.0/statement.html#GotoStatement

Where does it say that a goto into a catch block is categorically banned? It only says that a goto cannot skip a variable initialization.

catch(Type){}
and
catch{}

are valid forms too. Neither one contains a declaration.

Sure, usually a goto into a catch block means that someone is abusing exceptions for regular control flow, but if you just want a quick and dirty hack, or if a third-party API forces you to, I don't think the language should stand in your way.

Reply via email to