<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Poor diagnostic for conversions not possible due to explicit constructors"
href="https://llvm.org/bugs/show_bug.cgi?id=23398">23398</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Poor diagnostic for conversions not possible due to explicit constructors
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nicolasweber@gmx.de
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>