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: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs