www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - ICE when breaking outer loop from switch statement

reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
Stumbled into this today:

	http://d.puremagic.com/issues/show_bug.cgi?id=9068

A workaround is to put the loop in its own function and do a return
instead of "break X". Or an uglier workaround is to use a boolean flag
checked right after the switch statement.

In my case, I didn't have much to do after the foreach anyway, so the
first workaround suffices. In any case, this is a rather ugly bug.


T

-- 
"A one-question geek test. If you get the joke, you're a geek: Seen on a
California license plate on a VW Beetle: 'FEATURE'..." -- Joshua D.
Wachs - Natural Intelligence, Inc.
Nov 23 2012
parent Timon Gehr <timon.gehr gmx.ch> writes:
On 11/24/2012 01:16 AM, H. S. Teoh wrote:
 Stumbled into this today:

 	http://d.puremagic.com/issues/show_bug.cgi?id=9068

 A workaround is to put the loop in its own function and do a return
 instead of "break X". Or an uglier workaround is to use a boolean flag
 checked right after the switch statement.

Other workarounds are to include the code that is supposed to be executed after the loop inside the conditional that was supposed to guard the break and then return instead, or to just use goto.
 In my case, I didn't have much to do after the foreach anyway, so the
 first workaround suffices. In any case, this is a rather ugly bug.

Yup.
Nov 23 2012