re PR c++/28269 (ICE on attribute for invalid template)
authorLee Millward <lee.millward@gmail.com>
Sat, 15 Jul 2006 15:00:28 +0000 (15:00 +0000)
committerLee Millward <lmillward@gcc.gnu.org>
Sat, 15 Jul 2006 15:00:28 +0000 (15:00 +0000)
PR c++/28269
* parser.c (cp_parser_elaborated_type_specifier):
Return early if an invalid type was detected.

* g++.dg/template/crash54.C: New test.

From-SVN: r115475

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/crash54.C [new file with mode: 0644]

index c60d003a840892adff29764922084875b75cb05c..0dd1e8ca4c26a3ed4a7f6e56cf88eafdcf3218aa 100644 (file)
@@ -7,6 +7,10 @@
        type not being an acceptable Java parameter if 
        it's error_mark_node.
        
+       PR c++/28269
+       * parser.c (cp_parser_elaborated_type_specifier):
+       Return early if an invalid type was detected.
+       
 2006-07-15  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        PR c++/28249
index 81000bf47acb2a7d2e55475ac6b23d8ce1b0ece4..a2d41f164a7958d84d0ddd450a324b28cfa15cf8 100644 (file)
@@ -10247,6 +10247,9 @@ cp_parser_elaborated_type_specifier (cp_parser* parser,
        }
     }
 
+  if (type == error_mark_node)
+    return error_mark_node;
+
   /* Allow attributes on forward declarations of classes.  */
   if (attributes)
     {
index 863b4ab78545dc3d6c602919ad790872bbd5d526..92606e25ba2cffa0c05841461c74f0c87b7355ff 100644 (file)
@@ -2,6 +2,9 @@
 
        PR c++/28292
        * g++.dg/other/error12.C: New test.
+
+       PR c++/28269
+       * g++.dg/template/crash54.C: New test.
        
 2006-07-15  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
diff --git a/gcc/testsuite/g++.dg/template/crash54.C b/gcc/testsuite/g++.dg/template/crash54.C
new file mode 100644 (file)
index 0000000..26b4875
--- /dev/null
@@ -0,0 +1,5 @@
+//PR c++/28269
+
+template<int> struct A;
+
+struct __attribute__((unused)) A<0<; // { dg-error "template argument|unqualified-id" }