[LLVMbugs] [Bug 15819] New: Poor recovery for use of unknown identifier

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 22 07:23:20 PDT 2013


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: unassignedclangbugs at nondot.org
          Reporter: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130422/ef55d0a2/attachment.html>


More information about the llvm-bugs mailing list