From: Jason Merrill Date: Thu, 20 Nov 1997 03:55:02 +0000 (+0000) Subject: decl.c (make_implicit_typename): Handle case where t is not actually from context. X-Git-Tag: releases/egcs-1.0.0~103 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee3644d3b3b5fac703ff31a7879b66852ead1e5d;p=thirdparty%2Fgcc.git decl.c (make_implicit_typename): Handle case where t is not actually from context. * decl.c (make_implicit_typename): Handle case where t is not actually from context. * tree.c (get_type_decl): Lose identifier case. * spew.c (yylex): Lose useless call to identifer_typedecl_value. * parse.y (nonnested_type): Just use lookup_name. (complex_type_name): Just use IDENTIFIER_GLOBAL_VALUE. From-SVN: r16588 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3d38c4d7605c..1350bbac668f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +Wed Nov 19 18:24:14 1997 Jason Merrill + + * decl.c (make_implicit_typename): Handle case where t is not + actually from context. + * tree.c (get_type_decl): Lose identifier case. + * spew.c (yylex): Lose useless call to identifer_typedecl_value. + * parse.y (nonnested_type): Just use lookup_name. + (complex_type_name): Just use IDENTIFIER_GLOBAL_VALUE. + Wed Nov 19 10:39:27 1997 Jason Merrill * decl.c (make_implicit_typename): New fn. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 7a46a92d4166..fc07dc7df6e7 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4389,7 +4389,7 @@ make_implicit_typename (context, t) && DECL_CONTEXT (t) != context) { tree binfo = get_binfo (DECL_CONTEXT (t), context, 0); - for (;;) + while (binfo) { tree next = BINFO_INHERITANCE_CHAIN (binfo); if (! uses_template_parms (BINFO_TYPE (next)) @@ -4397,7 +4397,11 @@ make_implicit_typename (context, t) break; binfo = next; } - retval = make_typename_type (BINFO_TYPE (binfo), DECL_NAME (t)); + if (binfo) + retval = make_typename_type (BINFO_TYPE (binfo), DECL_NAME (t)); + else + /* FIXME: find the enclosing class whose base t comes from. */ + retval = make_typename_type (DECL_CONTEXT (t), DECL_NAME (t)); } else retval = make_typename_type (context, DECL_NAME (t)); diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 0906947b7313..18d4aa74a9f1 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -3017,18 +3017,15 @@ nonnested_type: { if (TREE_CODE ($1) == IDENTIFIER_NODE) { + $$ = lookup_name ($1, 1); if (current_class_type && TYPE_BEING_DEFINED (current_class_type) && ! IDENTIFIER_CLASS_VALUE ($1)) { - /* Be sure to get an inherited typedef. */ - $$ = lookup_name ($1, 1); /* Remember that this name has been used in the class definition, as per [class.scope0] */ pushdecl_class_level ($$); } - else - $$ = identifier_typedecl_value ($1); } else $$ = $1; @@ -3036,7 +3033,7 @@ nonnested_type: | global_scope type_name { if (TREE_CODE ($2) == IDENTIFIER_NODE) - $$ = identifier_typedecl_value ($2); + $$ = IDENTIFIER_GLOBAL_VALUE ($2); else $$ = $2; got_scope = NULL_TREE; @@ -3285,7 +3282,7 @@ complex_type_name: global_scope type_name { if (TREE_CODE ($2) == IDENTIFIER_NODE) - $$ = identifier_typedecl_value ($2); + $$ = IDENTIFIER_GLOBAL_VALUE ($2); else $$ = $2; got_scope = NULL_TREE; diff --git a/gcc/cp/spew.c b/gcc/cp/spew.c index b8280a27fa19..bed6e7b1330a 100644 --- a/gcc/cp/spew.c +++ b/gcc/cp/spew.c @@ -310,9 +310,7 @@ yylex () { case TYPENAME: case SELFNAME: - lastiddecl = identifier_typedecl_value (tmp_token.yylval.ttype); - if (lastiddecl != trrr) - lastiddecl = trrr; + lastiddecl = trrr; if (got_scope) tmp_token.yylval.ttype = trrr; break; diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index e94fd554057d..98b1a6d3b770 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1866,8 +1866,6 @@ tree get_type_decl (t) tree t; { - if (TREE_CODE (t) == IDENTIFIER_NODE) - return identifier_typedecl_value (t); if (TREE_CODE (t) == TYPE_DECL) return t; if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')