mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-24 18:09:34 +08:00
except.c (expand_throw): Use cp_finish_decl for the throw temp.
* except.c (expand_throw): Use cp_finish_decl for the throw temp. * cvt.c (build_up_reference): Pass DIRECT_BIND down into cp_finish_decl. * init.c (expand_default_init): Check for DIRECT_BIND instead of DECL_ARTIFICIAL. Fixes Sec15/1/P15140.C, g++.eh/ctor1.C. * call.c (build_over_call): Use build_decl. * except.c (expand_throw): Just use convert, not build_reinterpret_cast. Fixes Sec15/P15113.C. From-SVN: r23845
This commit is contained in:
parent
c4c2aca361
commit
c37dc68e57
@ -1,5 +1,16 @@
|
||||
1998-11-24 Jason Merrill <jason@yorick.cygnus.com>
|
||||
|
||||
* except.c (expand_throw): Use cp_finish_decl for the throw temp.
|
||||
* cvt.c (build_up_reference): Pass DIRECT_BIND down into
|
||||
cp_finish_decl.
|
||||
* init.c (expand_default_init): Check for DIRECT_BIND instead of
|
||||
DECL_ARTIFICIAL.
|
||||
|
||||
* call.c (build_over_call): Use build_decl.
|
||||
|
||||
* except.c (expand_throw): Just use convert, not
|
||||
build_reinterpret_cast.
|
||||
|
||||
* lex.c (handle_generic_pragma): Use token_buffer.
|
||||
|
||||
* decl.c (check_tag_decl): Don't complain about null friend decl.
|
||||
|
@ -3412,8 +3412,7 @@ build_over_call (cand, args, flags)
|
||||
return arg;
|
||||
else if (TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
|
||||
{
|
||||
val = build (VAR_DECL, DECL_CONTEXT (fn));
|
||||
layout_decl (val, 0);
|
||||
val = build_decl (VAR_DECL, NULL_TREE, DECL_CONTEXT (fn));
|
||||
val = build (TARGET_EXPR, DECL_CONTEXT (fn), val, arg, 0, 0);
|
||||
TREE_SIDE_EFFECTS (val) = 1;
|
||||
return val;
|
||||
|
@ -354,11 +354,13 @@ build_up_reference (type, arg, flags)
|
||||
DECL_ARTIFICIAL (arg) = 1;
|
||||
}
|
||||
DECL_INITIAL (arg) = targ;
|
||||
cp_finish_decl (arg, targ, NULL_TREE, 0, LOOKUP_ONLYCONVERTING);
|
||||
cp_finish_decl (arg, targ, NULL_TREE, 0,
|
||||
LOOKUP_ONLYCONVERTING|DIRECT_BIND);
|
||||
}
|
||||
else if (!(flags & DIRECT_BIND) && ! lvalue_p (arg))
|
||||
{
|
||||
tree slot = build_decl (VAR_DECL, NULL_TREE, argtype);
|
||||
DECL_ARTIFICIAL (slot) = 1;
|
||||
arg = build (TARGET_EXPR, argtype, slot, arg, NULL_TREE, NULL_TREE);
|
||||
TREE_SIDE_EFFECTS (arg) = 1;
|
||||
}
|
||||
|
@ -687,7 +687,8 @@ process_start_catch_block (declspecs, declarator)
|
||||
decl = pushdecl (decl);
|
||||
|
||||
start_decl_1 (decl);
|
||||
cp_finish_decl (decl, init, NULL_TREE, 0, LOOKUP_ONLYCONVERTING);
|
||||
cp_finish_decl (decl, init, NULL_TREE, 0,
|
||||
LOOKUP_ONLYCONVERTING|DIRECT_BIND);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1027,13 +1028,11 @@ expand_throw (exp)
|
||||
ourselves into expand_call. */
|
||||
if (TREE_SIDE_EFFECTS (exp))
|
||||
{
|
||||
tree temp = build (VAR_DECL, TREE_TYPE (exp));
|
||||
tree temp = build_decl (VAR_DECL, NULL_TREE, TREE_TYPE (exp));
|
||||
DECL_ARTIFICIAL (temp) = 1;
|
||||
layout_decl (temp, 0);
|
||||
DECL_RTL (temp) = assign_temp (TREE_TYPE (exp), 2, 0, 1);
|
||||
expand_expr (build (INIT_EXPR, TREE_TYPE (exp), temp, exp),
|
||||
NULL_RTX, VOIDmode, 0);
|
||||
expand_decl_cleanup (NULL_TREE, maybe_build_cleanup (temp));
|
||||
DECL_INITIAL (temp) = exp;
|
||||
cp_finish_decl (temp, exp, NULL_TREE, 0, LOOKUP_ONLYCONVERTING);
|
||||
exp = temp;
|
||||
}
|
||||
#endif
|
||||
@ -1072,7 +1071,7 @@ expand_throw (exp)
|
||||
|
||||
/* Cast EXP to `void *' so that it will match the prototype for
|
||||
__cp_push_exception. */
|
||||
exp = build_reinterpret_cast (ptr_type_node, exp);
|
||||
exp = convert (ptr_type_node, exp);
|
||||
|
||||
if (cleanup == NULL_TREE)
|
||||
{
|
||||
|
@ -1138,14 +1138,13 @@ expand_default_init (binfo, true_exp, exp, init, flags)
|
||||
if (true_exp != exp)
|
||||
abort ();
|
||||
|
||||
/* We special-case TARGET_EXPRs here to avoid an error about
|
||||
private copy constructors for temporaries bound to reference vars.
|
||||
If the TARGET_EXPR represents a call to a function that has
|
||||
permission to create such objects, a reference can bind directly
|
||||
to the return value. An object variable must be initialized
|
||||
via the copy constructor, even if the call is elided. */
|
||||
if (! (TREE_CODE (exp) == VAR_DECL && DECL_ARTIFICIAL (exp)
|
||||
&& TREE_CODE (init) == TARGET_EXPR && TREE_TYPE (init) == type))
|
||||
if (flags & DIRECT_BIND)
|
||||
/* Do nothing. We hit this in two cases: Reference initialization,
|
||||
where we aren't initializing a real variable, so we don't want
|
||||
to run a new constructor; and catching an exception, where we
|
||||
have already built up the constructor call so we could wrap it
|
||||
in an exception region. */;
|
||||
else
|
||||
init = ocp_convert (type, init, CONV_IMPLICIT|CONV_FORCE_TEMP, flags);
|
||||
|
||||
if (TREE_CODE (init) == TRY_CATCH_EXPR)
|
||||
|
Loading…
Reference in New Issue
Block a user