re PR c++/46852 (ICE: tree check: expected class ‘type’, have ‘exceptional’ (error_ma...
authorNathan Froyd <froydnj@codesourcery.com>
Thu, 16 Dec 2010 01:33:03 +0000 (01:33 +0000)
committerNathan Froyd <froydnj@gcc.gnu.org>
Thu, 16 Dec 2010 01:33:03 +0000 (01:33 +0000)
gcc/cp/
PR c++/46852
* parser.c (cp_parser_class_specifier): Check for TYPE_P.

gcc/testsuite/
PR c++/46852
* g++.dg/pr46852.C: New test.

From-SVN: r167894

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

index b28af3c..e6a9610 100644 (file)
@@ -1,3 +1,8 @@
+2010-12-15  Nathan Froyd  <froydnj@codesourcery.com>
+
+       PR c++/46852
+       * parser.c (cp_parser_class_specifier): Check for TYPE_P.
+
 2010-12-15  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/46815
index 4c8ca72..cb8b797 100644 (file)
@@ -16937,7 +16937,9 @@ cp_parser_class_specifier (cp_parser* parser)
        break;
       }
 
-    if (want_semicolon)
+    /* If we don't have a type, then something is very wrong and we
+       shouldn't try to do anything clever.  */
+    if (TYPE_P (type) && want_semicolon)
       {
        cp_token_position prev
          = cp_lexer_previous_token_position (parser->lexer);
index 8ca61f4..94a48eb 100644 (file)
@@ -1,3 +1,8 @@
+2010-12-15  Nathan Froyd  <froydnj@codesourcery.com>
+
+       PR c++/46852
+       * g++.dg/pr46852.C: New test.
+
 2010-12-16  Jan Hubicka  <jh@suse.cz>
 
        PR middle-end/46939
diff --git a/gcc/testsuite/g++.dg/pr46852.C b/gcc/testsuite/g++.dg/pr46852.C
new file mode 100644 (file)
index 0000000..2c9d8dd
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/46852
+// { dg-do compile }
+
+template
+<
+class
+{                              // { dg-error "" }