[LLVMbugs] [Bug 22924] New: Rejects-valid: braced init list on new[]
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Mar 16 11:05:17 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=22924
Bug ID: 22924
Summary: Rejects-valid: braced init list on new[]
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: paul_robinson at playstation.sony.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
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.
--
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/20150316/b233e54f/attachment.html>
More information about the llvm-bugs
mailing list