[llvm-bugs] [Bug 31742] New: Empty list initializer in dynamically-sized array operator new fails pedantic checks
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jan 24 12:27:37 PST 2017
https://llvm.org/bugs/show_bug.cgi?id=31742
Bug ID: 31742
Summary: Empty list initializer in dynamically-sized array
operator new fails pedantic checks
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: cygnus at michiru.ru
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Classification: Unclassified
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."
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170124/117516ea/attachment.html>
More information about the llvm-bugs
mailing list