<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 --- - Rejects-valid: braced init list on new[]"
href="https://llvm.org/bugs/show_bug.cgi?id=22924">22924</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Rejects-valid: braced init list on new[]
</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>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++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>paul_robinson@playstation.sony.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Providing 3 initializers for a 3-element array seems like it should work...
$ cat bad_init.cpp
class A {
public:
A(int a): value(a) { }
int value;
};
A *bp;
void foo() {
bp = new A[3] { A(3), A(5), A(7) };
}
$ clang++ bad_init.cpp -std=c++11
bad_init.cpp:8:36: error: no matching constructor for initialization of 'A'
bp = new A[3] { A(3), A(5), A(7) };
^
bad_init.cpp:3:2: note: candidate constructor not viable: requires single
argument 'a', but no arguments were provided
A(int a): value(a) { }
^
bad_init.cpp:1:7: note: candidate constructor (the implicit copy constructor)
not viable: requires 1 argument, but 0 were provided
class A {
^
bad_init.cpp:1:7: note: candidate constructor (the implicit move constructor)
not viable: requires 1 argument, but 0 were provided
bad_init.cpp:8:36: note: in implicit initialization of array element 3 with
omitted initializer
bp = new A[3] { A(3), A(5), A(7) };
^
1 error generated.</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>