[Issue 7835] switch case fallthrough error despite a break inside static foreach
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Apr 6 11:32:01 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=7835
--- Comment #5 from bearophile_hugs at eml.cc 2012-04-06 11:32:39 PDT ---
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?
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list