https://bugs.llvm.org/show_bug.cgi?id=52328

            Bug ID: 52328
           Summary: Poor diagnostic for missing semicolon before case
                    label
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangb...@nondot.org
          Reporter: h...@chromium.org
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@metafoo.co.uk

$ cat /tmp/a.c
void f(int x) {
         switch (x) {
         case 0: return  // <-- Missing semicolon.
         case 1: return;
         }
}

$ clang -c /tmp/a.c
/tmp/a.c:4:10: error: expected expression
         case 1: return;
         ^
1 error generated.



When the return statement has an expression, we get it right:

$ cat /tmp/b.c
int f(int x) {
         switch (x) {
         case 0: return 1  // <-- Missing semicolon.
         case 1: return 2;
         }
}

$ clang -c /tmp/b.c
/tmp/b.c:3:26: error: expected ';' after return statement
         case 0: return 1  // <-- Missing semicolon.
                         ^
                         ;
1 error generated.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to