<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 --- - Empty list initializer in dynamically-sized array operator new fails pedantic checks"
href="https://llvm.org/bugs/show_bug.cgi?id=31742">31742</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Empty list initializer in dynamically-sized array operator new fails pedantic checks
</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>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>cygnus@michiru.ru
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Trunk clang seems to treat empty list initializer in array operator new with a
non-constant array length as array of zero size at some point, which is usually
not visible, but fails with -pedantic-errors:
$ cat dynamic-new-value-init.cpp
void f(int n)
{
new int[n]{};
}
$ clang++ -std=c++11 -fsyntax-only -pedantic-errors dynamic-new-value-init.cpp
dynamic-new-value-init.cpp:3:15: error: zero size arrays are an extension
[-Werror,-Wzero-length-array]
new int[n]{};
^
1 error generated.
clang 3.9.[01] compiles this fine.
This problem is caused by r283406 "PR22924, PR22845, some of CWG1464: When
checking the initializer for an array new expression, distinguish between the
case of a constant and non-constant initializer."</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>