<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 --- - no matching conversion for functional-style cast from 'void' to 'X'"
href="https://llvm.org/bugs/show_bug.cgi?id=25619">25619</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>no matching conversion for functional-style cast from 'void' to 'X'
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.5
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>matthew@dempsky.org
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>G++ produces a better diagnostic here. In particular, I don't understand why
clang++ is talking about 'void'.
$ cat x.cc
struct X {
explicit X(int, int, int);
};
void F() {
X({1, 2, 3});
}
$ g++-4.8 -c x.cc -std=c++11
x.cc: In function ‘void F()’:
x.cc:6:14: error: converting to ‘X’ from initializer list would use explicit
constructor ‘X::X(int, int, int)’
X({1, 2, 3});
^
$ clang++-3.5 -c x.cc -std=c++11
x.cc:6:3: error: no matching conversion for functional-style cast from 'void'
to 'X'
X({1, 2, 3});
^~~~~~~~~~~
x.cc:1:8: note: candidate constructor (the implicit copy constructor) not
viable: cannot convert initializer list
argument to 'const X'
struct X {
^
x.cc:1:8: note: candidate constructor (the implicit move constructor) not
viable: cannot convert initializer list
argument to 'X'
struct X {
^
x.cc:2:12: note: candidate constructor not viable: requires 3 arguments, but 1
was provided
explicit X(int, int, int);
^
1 error generated.
$ clang++-3.5 --version
Ubuntu clang version 3.5.0-4ubuntu2~trusty2 (tags/RELEASE_350/final) (based on
LLVM 3.5.0)
Target: x86_64-pc-linux-gnu
Thread model: posix</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>