[llvm-bugs] [Bug 31806] New: Error message when invoking a constructor not very helpful

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 30 17:04:02 PST 2017


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

            Bug ID: 31806
           Summary: Error message when invoking a constructor not very
                    helpful
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: douglas_yung at playstation.sony.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Recently a change was in r292518 which (properly) caused the following code to
no longer compile:

class A {
public:
  A(){}
  ~A(){}
};
A foo(){ return A::A(); }

Now if you try to build this code, the compiler emits the following error
message:

test3.cpp:6:20: error: qualified reference to 'A' is a constructor name rather
than a type in this context
A foo(){ return A::A(); }

The error message given here is not really clear as to what the problem is. By
comparison, the error given by GCC is much clearer:

test3.cpp: In function ‘A foo()’:
test3.cpp:6:22: error: cannot call constructor ‘A::A’ directly [-fpermissive]
 A foo(){ return A::A(); }
                      ^
test3.cpp:6:22: error:   for a function-style cast, remove the redundant ‘::A’
[-fpermissive]

We should improve this error message.

-- 
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/20170131/e313bc14/attachment.html>


More information about the llvm-bugs mailing list