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 b28af3c0c8ff8934b6eca89e63fa84c5f3dae57a..e6a9610b29b04feb950d625adfb3d97ebdd195e4 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 4c8ca7288c63806889dcf1c339c0531f2122093f..cb8b79782ef83fae19bdaa32cef15c760321d3a3 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 8ca61f499182883b0a8902111e33ca04826d1e2f..94a48eb098b398f671365aba8f4450588dc9548a 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 "" }