* decl2.c, pt.c: Revert c++/7754 fix.

From-SVN: r57895
This commit is contained in:
Richard Henderson 2002-10-07 02:49:18 -07:00 committed by Richard Henderson
parent e0fbf84951
commit 01f4137fea
3 changed files with 36 additions and 43 deletions

View File

@ -1,3 +1,7 @@
2002-10-07 Richard Henderson <rth@redhat.com>
* decl2.c, pt.c: Revert c++/7754 fix.
2002-10-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> 2002-10-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/7804 PR c++/7804

View File

@ -1382,10 +1382,7 @@ finish_anon_union (anon_union_decl)
return; return;
} }
if (!processing_template_decl) main_decl = build_anon_union_vars (anon_union_decl,
{
main_decl
= build_anon_union_vars (anon_union_decl,
&DECL_ANON_UNION_ELEMS (anon_union_decl), &DECL_ANON_UNION_ELEMS (anon_union_decl),
static_p, external_p); static_p, external_p);
@ -1402,10 +1399,8 @@ finish_anon_union (anon_union_decl)
expand_anon_union_decl (anon_union_decl, expand_anon_union_decl (anon_union_decl,
NULL_TREE, NULL_TREE,
DECL_ANON_UNION_ELEMS (anon_union_decl)); DECL_ANON_UNION_ELEMS (anon_union_decl));
return;
} }
} else
add_decl_stmt (anon_union_decl); add_decl_stmt (anon_union_decl);
} }

View File

@ -6134,7 +6134,7 @@ tsubst_decl (t, args, type, complain)
} }
r = copy_decl (t); r = copy_decl (t);
TREE_TYPE (r) = complete_type (type); TREE_TYPE (r) = type;
c_apply_type_quals_to_decl (cp_type_quals (type), r); c_apply_type_quals_to_decl (cp_type_quals (type), r);
DECL_CONTEXT (r) = ctx; DECL_CONTEXT (r) = ctx;
/* Clear out the mangled name and RTL for the instantiation. */ /* Clear out the mangled name and RTL for the instantiation. */
@ -6173,8 +6173,6 @@ tsubst_decl (t, args, type, complain)
TREE_CHAIN (r) = NULL_TREE; TREE_CHAIN (r) = NULL_TREE;
if (TREE_CODE (r) == VAR_DECL && VOID_TYPE_P (type)) if (TREE_CODE (r) == VAR_DECL && VOID_TYPE_P (type))
cp_error_at ("instantiation of `%D' as type `%T'", r, type); cp_error_at ("instantiation of `%D' as type `%T'", r, type);
/* Compute the size, alignment, etc. of R. */
layout_decl (r, 0);
} }
break; break;
@ -7426,6 +7424,9 @@ tsubst_expr (t, args, complain, in_decl)
decl = tsubst (decl, args, complain, in_decl); decl = tsubst (decl, args, complain, in_decl);
if (decl != error_mark_node) if (decl != error_mark_node)
{ {
if (TREE_CODE (decl) != TYPE_DECL)
/* Make sure the type is instantiated now. */
complete_type (TREE_TYPE (decl));
if (init) if (init)
DECL_INITIAL (decl) = error_mark_node; DECL_INITIAL (decl) = error_mark_node;
/* By marking the declaration as instantiated, we avoid /* By marking the declaration as instantiated, we avoid
@ -7435,12 +7436,6 @@ tsubst_expr (t, args, complain, in_decl)
do. */ do. */
if (TREE_CODE (decl) == VAR_DECL) if (TREE_CODE (decl) == VAR_DECL)
DECL_TEMPLATE_INSTANTIATED (decl) = 1; DECL_TEMPLATE_INSTANTIATED (decl) = 1;
if (TREE_CODE (decl) == VAR_DECL
&& ANON_AGGR_TYPE_P (TREE_TYPE (decl)))
/* Anonymous aggregates are a special case. */
finish_anon_union (decl);
else
{
maybe_push_decl (decl); maybe_push_decl (decl);
if (DECL_PRETTY_FUNCTION_P (decl)) if (DECL_PRETTY_FUNCTION_P (decl))
{ {
@ -7456,7 +7451,6 @@ tsubst_expr (t, args, complain, in_decl)
cp_finish_decl (decl, init, NULL_TREE, 0); cp_finish_decl (decl, init, NULL_TREE, 0);
} }
} }
}
/* A DECL_STMT can also be used as an expression, in the condition /* A DECL_STMT can also be used as an expression, in the condition
clause of an if/for/while construct. If we aren't followed by clause of an if/for/while construct. If we aren't followed by