diff options
author | Jason Merrill <jason@gcc.gnu.org> | 1998-09-08 20:52:50 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-09-08 20:52:50 -0400 |
commit | 009425e185c045c143997bbb3030644b834475a2 (patch) | |
tree | 4dbdb194f8994b40fedf312d68687b04845003fe | |
parent | 1ba15a03c76013936005a055342d0fdca97058b7 (diff) | |
download | gcc-009425e185c045c143997bbb3030644b834475a2.zip gcc-009425e185c045c143997bbb3030644b834475a2.tar.gz gcc-009425e185c045c143997bbb3030644b834475a2.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/cp/decl.c | 9 | ||||
-rw-r--r-- | gcc/cp/error.c | 1 | ||||
-rw-r--r-- | gcc/cp/parse.c | 2 | ||||
-rw-r--r-- | gcc/cp/parse.y | 2 |
5 files changed, 22 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index deef002..c2f0099 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 488cd0b..1714e82 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 3a505c4..f06705e 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 4642f8d..be81233 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 29bfc9d..cbfe147 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 ')' { |