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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to