[Issue 200] New: Statement *must* follow label

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 16 13:11:10 PDT 2006


http://d.puremagic.com/issues/show_bug.cgi?id=200

           Summary: Statement *must* follow label
           Product: D
           Version: 0.160
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: ericanderton at yahoo.com


This one is pretty simple.  The parser seems to think that the only valid way
to use a label is if a statement directly follows it.  But shouldn't a label be
valid all by itself, if its the last line of a scope?

void main(){
        x:
}

test.d(3): found '}' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement
test.d(3): found 'EOF' instead of statement

The workaround for this one is dead simple: just use a ';' right after the
label.  IMO, that doesn't look like valid code.

void main(){
        x: ;
}


-- 




More information about the Digitalmars-d-bugs mailing list