[LLVMbugs] [Bug 12828] New: Fixit for variable definition after label

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon May 14 17:45:45 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=12828

             Bug #: 12828
           Summary: Fixit for variable definition after label
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: arcata at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


The following code is a syntax error in C99 (or at least, clang and gcc agree
that it's a syntax error):

---
int main() {
foo:
    int x = 0;
    return x;
}
---

It can be fixed by putting an empty statement after the label:

---
int main() {
foo:;
    int x = 0;
    return x;
}
---

However, the error given by clang isn't very descriptive:

---
def-after-label.c:3:5: error: expected expression
    int x = 0;
---

A more descriptive error message noting that a label may not be followed
immediately by a variable definition and a fixit inserting the empty statement
would be more helpful.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list