[llvm-bugs] [Bug 52328] New: Poor diagnostic for missing semicolon before case label
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Oct 27 01:02:34 PDT 2021
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: unassignedclangbugs at nondot.org
Reporter: hans at chromium.org
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211027/3e8c2ce3/attachment.html>
More information about the llvm-bugs
mailing list