http://d.puremagic.com/issues/show_bug.cgi?id=7835
--- Comment #7 from timon.g...@gmx.ch 2012-04-06 11:41:49 PDT --- (In reply to comment #5) > This compiles with no warnings and it seems to work correctly, but I don't > fully understand it: > > > import core.stdc.stdio: printf; > template TypeTuple(TList...) { > alias TList TypeTuple; > } > void main() { > char c = 'b'; > MySwitch: switch (c) { > case 'a': printf("1 a\n"); break; > foreach (o; TypeTuple!('b', 'c')) { > case o: printf("2 %c\n", c); break; > } > break; > default: printf("default"); > } > } > > > Is it correct? if the break inside here is meant to be the foreach break: > { case o: printf("2 %c\n", c); break; } > > Then why a single break is enough after: > > foreach (o; TypeTuple!('b', 'c')) { > case o: printf("2 %c\n", c); break; > } > break; > > despite the foreach synthesizes more than one switch case? Your code is expanded to: void main() { char c = 'b'; switch (c) { case 'a': printf("1 a\n"); break; {case 'b': printf("2 %c\n", c); goto break_foreach;} {case 'c': printf("2 %c\n", c); goto break_foreach;} break_foreach: break; default: printf("default"); } } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------