[LLVMbugs] [Bug 23398] New: Poor diagnostic for conversions not possible due to explicit constructors

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat May 2 11:24:54 PDT 2015


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

            Bug ID: 23398
           Summary: Poor diagnostic for conversions not possible due to
                    explicit constructors
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Nicos-MacBook-Pro-4:src thakis$ cat test.cc
struct S {
  explicit S(int);
};

void f() {
  S s = 1;
}
Nicos-MacBook-Pro-4:src thakis$ clang -c test.cc 
test.cc:6:5: error: no viable conversion from 'int' to 'S'
  S s = 1;
    ^   ~
test.cc:1:8: note: candidate constructor (the implicit copy constructor) not
viable: no known conversion from 'int' to 'const S &' for 1st argument
struct S {
       ^
1 error generated.



The interesting note would be "note: explicit S(int) not a candidate
constructor because it's explicit" or something like that. Instead we list
implicit copy (and, in c++11, move ctors) which are beside the point.

-- 
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/20150502/2c5cad6f/attachment.html>


More information about the llvm-bugs mailing list