Index: gcc/testsuite/g++.dg/template/crash54.C =================================================================== --- gcc/testsuite/g++.dg/template/crash54.C (revision 0) +++ gcc/testsuite/g++.dg/template/crash54.C (revision 0) @@ -0,0 +1,6 @@ +//PR c++/28269 + +template struct A; + +struct __attribute__((unused)) A<0<; // { dg-error "template argument|unqualified-id" } + Index: gcc/cp/parser.c =================================================================== --- gcc/cp/parser.c (revision 115296) +++ gcc/cp/parser.c (working copy) @@ -10239,6 +10239,9 @@ cp_parser_elaborated_type_specifier (cp_ } } + if (type == error_mark_node) + return error_mark_node; + /* Allow attributes on forward declarations of classes. */ if (attributes) {