[LLVMbugs] [Bug 8626] New: clang++ produces poor diagnostic for function-style cast with no matching constructors

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 16 08:19:28 PST 2010


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

           Summary: clang++ produces poor diagnostic for function-style
                    cast with no matching constructors
           Product: clang
           Version: 2.8
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: llvmbugs at cs.uiuc.edu


Given this code:

struct A {};
struct B {};
struct C { C(A, B); };
C f(B &b) { return C(A()); }


clang++ says the following:

clang-fsc.cpp:4:20: error: functional-style cast from 'A' to 'C' is not allowed
C f(B &b) { return C(A()); }
                   ^
1 error generated.


g++ produces a much more helpful diagnostic:

clang-fsc.cpp: In function ‘C f(B&)’:
clang-fsc.cpp:4: error: no matching function for call to ‘C::C(A)’
clang-fsc.cpp:3: note: candidates are: C::C(A, B)
clang-fsc.cpp:3: note:                 C::C(const C&)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list