<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - Single-(non-list) element braced initializer argument rejects user defined conversion"
href="https://bugs.llvm.org/show_bug.cgi?id=36077">36077</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Single-(non-list) element braced initializer argument rejects user defined conversion
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</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>hstong@ca.ibm.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>In the following, the copy list-initialization of the parameter of foo, which
is of non-aggregate class type, from the single-(non-list) element
braced-init-list should succeed through selection of A's copy constructor in
the second phase of [over.match.list]. GCC compiles this code, as does MSVC and
ICC.
This appears to be related to CWG 2076, the resolution of which is included in
C++17.
### SOURCE (<stdin>):
struct A { A(const A &); };
struct B { operator A() const; };
void foo(A);
void bar(const B &b) { foo({b}); }
### COMPILER INVOCATION COMMAND:
clang -cc1 -x c++ -std=c++17 -
### ACTUAL OUTPUT:
<stdin>:5:24: error: no matching function for call to 'foo'
void bar(const B &b) { foo({b}); }
^~~
<stdin>:4:6: note: candidate function not viable: cannot convert initializer
list argument to 'A'
void foo(A);
^
1 error generated.
### EXPECTED OUTPUT:
(Clean compile).
### COMPILER VERSION INFO (clang -v):
clang version 7.0.0 (<a href="https://github.com/llvm-mirror/clang.git">https://github.com/llvm-mirror/clang.git</a>
39491d7b6098f96eb1f88d68068eb654c1e2bd81)
(<a href="https://github.com/llvm-mirror/llvm.git">https://github.com/llvm-mirror/llvm.git</a>
c127e0c9742f746fe7198222bf6442b81787292e)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/wandbox/clang-head/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64</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>