aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-04-26 15:28:25 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-04-26 15:28:25 -0400
commit574cfaa47dbcc2e8d9ea68b83d8dc3122832ff9b (patch)
treee83e77854b5490319145c8e64a21bec89b47616f /gcc/cp/call.c
parent5a87ca71c875b5bc34b9b8bc0ef405cec9b51b51 (diff)
downloadgcc-574cfaa47dbcc2e8d9ea68b83d8dc3122832ff9b.zip
gcc-574cfaa47dbcc2e8d9ea68b83d8dc3122832ff9b.tar.gz
gcc-574cfaa47dbcc2e8d9ea68b83d8dc3122832ff9b.tar.bz2
re PR c++/48530 ([C++0x][SFINAE] Hard errors with deleted d'tors)
PR c++/48530 * decl.c (cxx_maybe_build_cleanup): Add complain parm. * tree.c (force_target_expr): Add complain parm. (build_target_expr_with_type): Likewise. (get_target_expr_sfinae): Split out. (build_vec_init_expr, bot_manip): Adjust. * init.c (build_vec_delete, build_vec_delete_1): Add complain parm. (build_delete, build_dtor_call): Likewise. (perform_direct_initialization_if_possible): Adjust. (build_vec_init): Handle error return. * cvt.c (force_rvalue): Add complain parm. Call build_special_member_call directly. * decl2.c (delete_sanity): Add complain parm. (build_cleanup): Adjust. * pt.c (tsubst_copy_and_build, tsubst_expr): Adjust. * semantics.c (finish_stmt_expr_expr): Adjust. (finish_compound_literal): Adjust. * parser.c (cp_parser_delete_expression): Adjust. * typeck2.c (build_functional_cast): Adjust. * cp-tree.h: Adjust. From-SVN: r172985
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index cf8e1a5..10efd1c 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -4144,7 +4144,11 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3,
&& TREE_CODE (arg3) != THROW_EXPR)
{
if (!VOID_TYPE_P (arg3_type))
- arg3 = force_rvalue (arg3);
+ {
+ arg3 = force_rvalue (arg3, complain);
+ if (arg3 == error_mark_node)
+ return error_mark_node;
+ }
arg3_type = TREE_TYPE (arg3);
result_type = arg3_type;
}
@@ -4152,7 +4156,11 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3,
&& TREE_CODE (arg3) == THROW_EXPR)
{
if (!VOID_TYPE_P (arg2_type))
- arg2 = force_rvalue (arg2);
+ {
+ arg2 = force_rvalue (arg2, complain);
+ if (arg2 == error_mark_node)
+ return error_mark_node;
+ }
arg2_type = TREE_TYPE (arg2);
result_type = arg2_type;
}
@@ -4359,11 +4367,11 @@ build_conditional_expr (tree arg1, tree arg2, tree arg3,
that isn't wrapped with a TARGET_EXPR plays havoc with exception
regions. */
- arg2 = force_rvalue (arg2);
+ arg2 = force_rvalue (arg2, complain);
if (!CLASS_TYPE_P (arg2_type))
arg2_type = TREE_TYPE (arg2);
- arg3 = force_rvalue (arg3);
+ arg3 = force_rvalue (arg3, complain);
if (!CLASS_TYPE_P (arg3_type))
arg3_type = TREE_TYPE (arg3);
@@ -5642,7 +5650,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
expr = convert_bitfield_to_declared_type (expr);
expr = fold_convert (type, expr);
}
- expr = build_target_expr_with_type (expr, type);
+ expr = build_target_expr_with_type (expr, type, complain);
}
/* Take the address of the thing to which we will bind the
@@ -6341,7 +6349,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
if (TREE_CODE (arg) == TARGET_EXPR)
return arg;
else if (trivial)
- return force_target_expr (DECL_CONTEXT (fn), arg);
+ return force_target_expr (DECL_CONTEXT (fn), arg, complain);
}
else if (TREE_CODE (arg) == TARGET_EXPR || trivial)
{
@@ -8246,7 +8254,7 @@ set_up_extended_ref_temp (tree decl, tree expr, tree *cleanup, tree *initp)
if (TREE_STATIC (var))
init = add_stmt_to_compound (init, register_dtor_fn (var));
else
- *cleanup = cxx_maybe_build_cleanup (var);
+ *cleanup = cxx_maybe_build_cleanup (var, tf_warning_or_error);
/* We must be careful to destroy the temporary only
after its initialization has taken place. If the