[llvm-bugs] [Bug 25834] New: Bad error message for extra parens around declaration inside if

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 15 14:04:53 PST 2015


https://llvm.org/bugs/show_bug.cgi?id=25834

            Bug ID: 25834
           Summary: Bad error message for extra parens around declaration
                    inside if
           Product: clang
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: htam at apple.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

This code:

    extern int foo();

    int main(void) {
        if ((auto x = foo())) {
            return 1;
        }
        return 0;
    }

When compiled with `clang++ -std=c++11` produces the following error messages:
test.cc:5:15: error: expected ')'
    if ((auto x = foo())) {
              ^
test.cc:5:9: note: to match this '('
    if ((auto x = foo())) {
        ^
test.cc:5:25: error: expected expression
    if ((auto x = foo())) {
                        ^
2 errors generated.

This is not a great error message.  I'd expect something like "declaration with
extraneous parentheses" and a fixit to remove the extra parentheses.

-- 
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/20151215/c2eeb384/attachment.html>


More information about the llvm-bugs mailing list