March 04, 2013 [Issue 9642] New: Missed switch case fallthrough | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=9642 Summary: Missed switch case fallthrough Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Keywords: accepts-invalid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2013-03-03 17:26:28 PST --- void main() { int x; switch ('x') { case 'a': x++; case 'b': .. case 'c': x++; break; default: } } With dmd 2.063alpha it compiles with no errors nor warnings. But I think it should give an error like: test.d(6): Error: switch case fallthrough - use 'goto default;' if intended -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 04, 2013 [Issue 9642] Missed switch case fallthrough | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=9642 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich@gmail.com --- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-03-03 17:34:42 PST --- It looks like it wasn't properly implemented, e.g. this will error with -w: void main() { int x; switch ('x') { case 'a': x++; case 'b':// .. case 'c': x++; break; default: } } Note the commented out code. Tested in 2.063 -- 2.060. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation