Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Brace initialization bug
void foo() {
new int[1] {1};
template<int A>
void goo() {
new int[1] {1};
int main() {
phst commented Mar 27, 2012

The above code produces an error with G++ 4.7:

g++-4.7 -Wall -Wextra -std=c++11 b.cpp 
b.cpp: In instantiation of 'void goo() [with int A = 1]':
b.cpp:12:10:   required from here
b.cpp:7:3: error: parenthesized initializer in array new [-fpermissive]
b.cpp:7: confused by earlier errors, bailing out

Commenting out the instantiation of goo removes the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.