The following code snippet triggers a segfault since GCC 4.0.0: ================================================================= struct A { template<int> void foo(int = ((struct { int i; }) {0}).i); }; ================================================================= bug.cc:3: error: template class without a name bug.cc:3: error: 'struct A::<anonymous>' does not declare a template type bug.cc:3: internal compiler error: Segmentation fault Please submit a full bug report, [etc.]
Note: given the C99 extensions, this is actually reject-valid: for instance Comeau in relaxed mode accepts it.
Closing 4.1 branch.
With the patch for PR37649 the testcase doesn't ICE on mainline anymore. According to Paolo's comment, this is still rejects-valid, though.
Closing 4.2 branch.
GCC 4.3.4 is being released, adjusting target milestone.
GCC 4.3.5 is being released, adjusting target milestone.
Only the ICE was a regression; that's fixed, so this is no longer a regression bug.
clang also rejects this: <source>:3:34: error: 'A::(unnamed struct at <source>:3:34)' cannot be defined in a type specifier template<int> void foo(int = ((struct { int i; }) {0}).i); ^ <source>:3:57: error: member reference base type 'void' is not a structure or union template<int> void foo(int = ((struct { int i; }) {0}).i); ~~~~~~~~~~~~~~~~~~~~~~~~~^~ 2 errors generated.