digitalmars.D.bugs - [Issue 10199] New: labels cannot be used without a statement
- d-bugmail puremagic.com (45/45) May 29 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10199
- d-bugmail puremagic.com (15/15) May 29 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10199
http://d.puremagic.com/issues/show_bug.cgi?id=10199 Summary: labels cannot be used without a statement Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: monarchdodra gmail.com Basically, if I have a "end:" label, that is followed by nothing (because, well, end; the function is over), it is considered wrong: //----- void main() { goto end; end: //main.d(5): Error: found '}' instead of statement } //----- Workaround is to use a dummy statement: //----- void main() { goto end; end: ; //OK: Found a statement } //----- I'd also note that the workaround should be considered a bug, just the same way you aren't allowed to use an empty statement after a if/else/for/while. I think the workaround should be turned down, in favor of: //----- void main() { goto end; end: {} //OK: Found an (explicitly empty) statement } //----- But this point is minor, the problem is that a label *can't* be used without an identifier. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 29 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10199 Alex Rønne Petersen <alex lycus.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |alex lycus.org Resolution| |INVALID CEST --- This is by design. Labels in D aren't just "labels", they are labelled statements; not the same thing as in C. You're supposed to use `{}` to denote an empty statement to jump to. `;` being allowed is a legacy artifact that will (hopefully!) be killed eventually. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 29 2013