[Issue 10199] New: labels cannot be used without a statement
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed May 29 03:05:55 PDT 2013
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 at puremagic.com
ReportedBy: monarchdodra at gmail.com
--- Comment #0 from monarchdodra at gmail.com 2013-05-29 03:05:54 PDT ---
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: -------
More information about the Digitalmars-d-bugs
mailing list