Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Brace initialization bug

View gist:2220810
1 2 3 4 5 6 7 8 9 10 11 12 13
void foo() {
new int[1] {1};
}
 
template<int A>
void goo() {
new int[1] {1};
}
 
int main() {
foo();
goo<1>();
}
Owner
phst commented

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.