-
Bug
-
Resolution: Unresolved
-
Not Prioritized
-
Code Generation Tools
-
CODEGEN-12006
-
PRU_2.3.3
-
default
The compiler sometimes rejects compound literals when the intended type of the literal is a template type. Note that compound literals are a C99 feature, not a C++ feature, but the parser does support compound literals in C++ in relaxed mode, so the parser should accept this test case. It looks like the parser rejects template types when they aren't implicitly instantiated at an earlier point in the code.
template< int n > struct Foo { }; // Uncomment this line and it builds clean // Foo<0> blah; // implicitly instantiates Foo<0> void init_foo( Foo<0> *p ) { *p = (Foo<0>){ }; // error: a compound literal of type "Foo<0>" is not allowed }