[llvm-bugs] [Bug 29055] New: Improve diagnostic for assigning a type to a variable.

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 19 06:47:56 PDT 2016


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

            Bug ID: 29055
           Summary: Improve diagnostic for assigning a type to a variable.
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: gonzalobg88 at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

This:

struct A {};
auto a = decltype(A{});

produces this error:

4 : error: expected '(' for function-style cast or type construction
auto a = decltype(A{});
~~~~~~~~~~~~~^

Either the user meant something like:

auto a = decltype(A{}){};

or it meant "using" instead of "auto":

using a = decltype(A{});

While the current error message is technically correct, it should be more user
friendly. It would be better if it would suggest both options in a note.

-- 
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/20160819/f40e3e27/attachment.html>


More information about the llvm-bugs mailing list