https://llvm.org/bugs/show_bug.cgi?id=31147
Bug ID: 31147 Summary: Unfortunate diagnostic for missing brace Product: clang Version: unspecified Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: C++ Assignee: unassignedclangb...@nondot.org Reporter: chisophu...@gmail.com CC: dgre...@apple.com, llvm-bugs@lists.llvm.org Classification: Unclassified I'm not sure if there's anything clang can do better here without extreme measures like looking at whitespace, but a coworker and I lost a solid 15 minutes or more due to a situation like this coming up in the wild: namespace Qux { struct Foo { Foo(int x) : x(x) {} void bar() { if (x) { baz(); } void baz(); int x; }; } There's only one real error here (the missing closing brace of the `if`), but clang gives a bunch of errors, none of which points at the problem. In the way that this manifested in the wild, the outer namespace actually continued on for many many more lines, so there was a huge wall of spurious errors. sean:~/tmp % clang++ -fsyntax-only test.cc test.cc:3:16: error: member initializer 'x' does not name a non-static data member or base class Foo(int x) : x(x) {} ^~~~ test.cc:6:9: error: use of undeclared identifier 'x' if (x) { ^ test.cc:7:7: error: use of undeclared identifier 'baz'; did you mean 'bar'? baz(); ^~~ bar test.cc:5:8: note: 'bar' declared here void bar() { ^ test.cc:14:2: error: expected ';' after struct } ^ ; test.cc:16:1: error: expected '}' ^ test.cc:1:15: note: to match this '{' namespace Qux { ^ 5 errors 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 http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs