https://llvm.org/bugs/show_bug.cgi?id=26489
Bug ID: 26489 Summary: improve error message for 'label prefixing declaration' Product: clang Version: trunk Hardware: PC OS: Windows NT Status: NEW Severity: normal Priority: P Component: Frontend Assignee: unassignedclangb...@nondot.org Reporter: chengnian...@gmail.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified I think the error message by clang can be more user friendly. When I put a label before a declaration, I got "error: expected expression". Then I used gcc and got to know the reason. $: cat t.c void f() { l1: int a = 1; goto l1; } $: clang-trunk t.c t.c:3:5: error: expected expression int a = 1; ^ 1 error generated. $: gcc-trunk t.c t.c: In function âfâ: t.c:3:5: error: a label can only be part of a statement and a declaration is not a statement int a = 1; ^~~ $: clang-trunk -v clang version 3.9.0 (trunk 259077) (llvm/trunk 259321) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/local/bin Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.2 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.1 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.2 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.1.0 Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Candidate multilib: x32;@mx32 Selected multilib: .;@m64 $: -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs