error.c (dump_type_real): Handle NAMESPACE_DECL.
authorJason Merrill <jason@gcc.gnu.org>
Wed, 9 Sep 1998 00:52:50 +0000 (20:52 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 9 Sep 1998 00:52:50 +0000 (20:52 -0400)
* error.c (dump_type_real): Handle NAMESPACE_DECL.
* parse.y (base_class.1): Avoid crash on error.
* decl.c (make_typename_type): If context is a namespace, the code
is in error.

From-SVN: r22342

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/error.c
gcc/cp/parse.c
gcc/cp/parse.y

index deef002100eb2888cb7ccc2404af9bdc546128a6..c2f0099896790a672a5313dd826a3c22f1b9a714 100644 (file)
@@ -1,3 +1,13 @@
+1998-09-09  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * error.c (dump_type_real): Handle NAMESPACE_DECL.
+       * parse.y (base_class.1): Avoid crash on error.
+
+1998-09-08  Martin von Löwis  <loewis@informatik.hu-berlin.de>
+
+       * decl.c (make_typename_type): If context is a namespace, the code
+       is in error.
+
 1998-09-08  Mumit Khan  <khan@xraylith.wisc.edu>
 
        * parse.y (nomods_initdcl0): Set up the parser stack correctly.
index 488cd0bc6b49138b75dc8c13233b86af69e912d4..1714e828aea622cefb97282bf2dccf5b88572671 100644 (file)
@@ -4782,6 +4782,15 @@ make_typename_type (context, name)
 
   fullname = name;
 
+  if (TREE_CODE (context) == NAMESPACE_DECL)
+    {
+      /* We can get here from typename_sub0 in the explicit_template_type
+        expansion.  Just fail.  */
+      cp_error ("no class template named `%#T' in `%#T'",
+               name, context);
+      return error_mark_node;
+    }
+
   if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
     {
       name = TREE_OPERAND (name, 0);
index 3a505c4f0ebe5e9e37053fc02191b134ebb8405f..f06705ecc9fd8cec53f371f9c0b7159903adce7a 100644 (file)
@@ -211,6 +211,7 @@ dump_type_real (t, v, canonical_name)
 
     case TYPE_DECL:
     case TEMPLATE_DECL:
+    case NAMESPACE_DECL:
       dump_decl (t, v);
       break;
 
index 4642f8d52add8bcf905d839e95e05cfd49c5e5a4..be81233bda55af53bb4ce3debcca68de54ba11af 100644 (file)
@@ -6207,7 +6207,7 @@ case 510:
     break;}
 case 511:
 #line 2276 "parse.y"
-{ yyval.ttype = TYPE_MAIN_DECL (yyvsp[0].ttype); ;
+{ if (yyval.ttype != error_mark_node) yyval.ttype = TYPE_MAIN_DECL (yyvsp[0].ttype); ;
     break;}
 case 513:
 #line 2279 "parse.y"
index 29bfc9d90c16de8b03a9c950be642d5a65bda111..cbfe147a48c8a4f03c41845a57c72a45a4a6d2b8 100644 (file)
@@ -2273,7 +2273,7 @@ base_class:
 
 base_class.1:
          typename_sub
-               { $$ = TYPE_MAIN_DECL ($1); }
+               { if ($$ != error_mark_node) $$ = TYPE_MAIN_DECL ($1); }
        | nonnested_type
        | SIGOF '(' expr ')'
                {