diff options
author | Jason Merrill <jason@gcc.gnu.org> | 1998-05-26 07:43:52 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-05-26 07:43:52 -0400 |
commit | 7fb4a8f7e65f7e2d4f84ba958fd544080d1a69b1 (patch) | |
tree | c52b599634675e48b34761d2c35c11a984732ccb | |
parent | 97cf4d2d5d05615ab610302adde25adc6d252b87 (diff) | |
download | gcc-7fb4a8f7e65f7e2d4f84ba958fd544080d1a69b1.zip gcc-7fb4a8f7e65f7e2d4f84ba958fd544080d1a69b1.tar.gz gcc-7fb4a8f7e65f7e2d4f84ba958fd544080d1a69b1.tar.bz2 |
decl.c (pushdecl): Don't copy the type_decl.
* decl.c (pushdecl): Don't copy the type_decl.
* class.c (pushclass): Always store TYPE_MAIN_VARIANT in
current_class_type.
* decl.c (grokdeclarator): Put typedefs on the type's obstack.
* parse.y (complex_direct_notype_declarator): Use $1 to access
scope of notype_qualified_id.
From-SVN: r20061
-rw-r--r-- | gcc/cp/ChangeLog | 15 | ||||
-rw-r--r-- | gcc/cp/class.c | 1 | ||||
-rw-r--r-- | gcc/cp/decl.c | 45 | ||||
-rw-r--r-- | gcc/cp/parse.c | 6 | ||||
-rw-r--r-- | gcc/cp/parse.y | 6 |
5 files changed, 28 insertions, 45 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b3c572c..21e0c6e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,9 +1,22 @@ +1998-05-26 Jason Merrill <jason@yorick.cygnus.com> + + * decl.c (pushdecl): Don't copy the type_decl. + +1998-05-26 Martin v. Löwis <loewis@informatik.hu-berlin.de> + + * class.c (pushclass): Always store TYPE_MAIN_VARIANT in + current_class_type. + * decl.c (grokdeclarator): Put typedefs on the type's obstack. + + * parse.y (complex_direct_notype_declarator): Use $1 to access + scope of notype_qualified_id. + 1998-05-26 Dave Brolley <brolley@cygnus.com> * lex.c (parse_options,yy_cur,yy_lim): Add for cpplib. (init_parse): Initialize cpplib interface. - * Makefile.in (CXX_OBJS): Make sure dependencies nenver end with an + * Makefile.in (CXX_OBJS): Make sure dependencies never end with an empty continuation. 1998-05-26 Mark Mitchell <mark@markmitchell.com> diff --git a/gcc/cp/class.c b/gcc/cp/class.c index ad4ff00..e7019a8 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -4668,6 +4668,7 @@ pushclass (type, modify) tree type; int modify; { + type = TYPE_MAIN_VARIANT (type); push_memoized_context (type, modify); current_class_depth++; diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 804e225..822874e 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -3373,43 +3373,6 @@ pushdecl (x) { push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type)); - if (!TREE_PERMANENT (x) - && TYPE_OBSTACK (type) != saveable_obstack) - { - /* X should have been allocated on the saveable - obstack. Since the type was not, the type may - outlive X, unless we make a copy of X. Here are - some examples: - - template <class T> - void f() - { - typedef S<T> Type_t; - Type_t::foo(); - } - - Here, we will create a SCOPE_REF with Type_t as - its first argument, and save the SCOPE_REF for - later, so that we can tsubst into it. But, that - means we need to save the TYPE_DECL for Type_t. - - But, we must save the TYPE_DECL even when not - processing_template_decl. For example, - - void f() - { - typedef int I; - g<I>(); - } - - may create a declaration of g with `I' as one of - the arguments. In the old days, we used to use - the underlying types for things, but now we try - to use the typedef names for readability. */ - x = copy_node (x); - copy_lang_decl (x); - } - DECL_ORIGINAL_TYPE (x) = type; type = build_type_copy (type); TYPE_STUB_DECL (type) = TYPE_STUB_DECL (DECL_ORIGINAL_TYPE (x)); @@ -9624,7 +9587,13 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) else if (current_lang_name == lang_name_java) decl = build_lang_decl (TYPE_DECL, declarator, type); else - decl = build_decl (TYPE_DECL, declarator, type); + { + /* Make sure this typedef lives as long as its type, + since it might be used as a template parameter. */ + push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type)); + decl = build_decl (TYPE_DECL, declarator, type); + pop_obstacks (); + } /* If the user declares "struct {...} foo" then `foo' will have an anonymous name. Fill that name in now. Nothing can diff --git a/gcc/cp/parse.c b/gcc/cp/parse.c index 69a212e..2ee7230 100644 --- a/gcc/cp/parse.c +++ b/gcc/cp/parse.c @@ -6596,10 +6596,10 @@ case 590: break;} case 591: #line 2743 "parse.y" -{ if (OP0 (yyval.ttype) != current_class_type) +{ if (OP0 (yyvsp[0].ttype) != current_class_type) { - push_nested_class (OP0 (yyval.ttype), 3); - TREE_COMPLEXITY (yyval.ttype) = current_class_depth; + push_nested_class (OP0 (yyvsp[0].ttype), 3); + TREE_COMPLEXITY (yyvsp[0].ttype) = current_class_depth; } ; break;} diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 8f04278..664256e 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -2740,10 +2740,10 @@ complex_direct_notype_declarator: | direct_notype_declarator '[' ']' { $$ = build_parse_node (ARRAY_REF, $$, NULL_TREE); } | notype_qualified_id - { if (OP0 ($$) != current_class_type) + { if (OP0 ($1) != current_class_type) { - push_nested_class (OP0 ($$), 3); - TREE_COMPLEXITY ($$) = current_class_depth; + push_nested_class (OP0 ($1), 3); + TREE_COMPLEXITY ($1) = current_class_depth; } } | nested_name_specifier notype_template_declarator |