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

            Bug ID: 15819
           Summary: Poor recovery for use of unknown identifier
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

<stdin>:1:29: error: unknown type name 'B'
struct A {}; void f() { A x(B); }
                            ^
<stdin>:1:28: warning: parentheses were disambiguated as a function declaration
[-Wvexing-parse]
struct A {}; void f() { A x(B); }
                           ^~~
<stdin>:1:29: note: add a pair of parentheses to declare a variable
struct A {}; void f() { A x(B); }
                            ^
                            ( )

Um. What. The first diagnostic is bad -- we should be expecting 'B' to be a
variable, not a type, here, because a function declaration at block scope is
very unlikely.

The second diagnostic is very bad. I'm not sure whether we kept the type or
dropped it, but either way, we shouldn't issue this diagnostic if we had a
parse error in the declaration. The note is also broken -- observe that it
suggests adding the close-paren after the existing close-paren, not before it
where it belongs.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to