From: Jason Merrill Date: Wed, 9 Sep 1998 00:52:50 +0000 (-0400) Subject: error.c (dump_type_real): Handle NAMESPACE_DECL. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=009425e185c045c143997bbb3030644b834475a2;p=gcc.git error.c (dump_type_real): Handle NAMESPACE_DECL. * 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index deef002100e..c2f00998967 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +1998-09-09 Jason Merrill + + * error.c (dump_type_real): Handle NAMESPACE_DECL. + * parse.y (base_class.1): Avoid crash on error. + +1998-09-08 Martin von Löwis + + * decl.c (make_typename_type): If context is a namespace, the code + is in error. + 1998-09-08 Mumit Khan * parse.y (nomods_initdcl0): Set up the parser stack correctly. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 488cd0bc6b4..1714e828aea 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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); diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 3a505c4f0eb..f06705ecc9f 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -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; diff --git a/gcc/cp/parse.c b/gcc/cp/parse.c index 4642f8d52ad..be81233bda5 100644 --- a/gcc/cp/parse.c +++ b/gcc/cp/parse.c @@ -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" diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 29bfc9d90c1..cbfe147a48c 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -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 ')' {