Commit 7fb4a8f7 by Jason Merrill

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
parent 97cf4d2d
1998-05-26 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (pushdecl): Don't copy the type_decl.
1998-05-26 Martin v. Lwis <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>
......
......@@ -4668,6 +4668,7 @@ pushclass (type, modify)
tree type;
int modify;
{
type = TYPE_MAIN_VARIANT (type);
push_memoized_context (type, modify);
current_class_depth++;
......
......@@ -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
......
......@@ -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;}
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment