diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2013-04-11 16:02:00 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2013-04-11 16:02:00 +0000 |
commit | 76545796c5181baef9511af159178aef8d93de7c (patch) | |
tree | 45373e6c1fa83e644725f453a809abafe53be489 /gcc/cp/call.c | |
parent | ffe0f557a7913be8b229e8fe9fd3dea7af0f158d (diff) | |
download | gcc-76545796c5181baef9511af159178aef8d93de7c.zip gcc-76545796c5181baef9511af159178aef8d93de7c.tar.gz gcc-76545796c5181baef9511af159178aef8d93de7c.tar.bz2 |
call.c (build_conditional_expr_1, [...]): Protect error calls with complain & tf_error.
2013-04-11 Paolo Carlini <paolo.carlini@oracle.com>
* call.c (build_conditional_expr_1, build_over_call): Protect
error calls with complain & tf_error.
* typeck.c (finish_class_member_access_expr, cp_build_binary_op,
build_x_unary_op, cp_build_unary_op, cp_build_compound_expr,
build_ptrmemfunc): Likewise.
(lookup_destructor): Take tsubst_flags_t parameter, adjust.
* cvt.c (warn_ref_binding): Rename to diagnose_ref_binding.
(convert_to_reference): Adjust.
From-SVN: r197813
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 9b0cbe4..4c59866 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4577,8 +4577,9 @@ build_conditional_expr_1 (tree arg1, tree arg2, tree arg3, || (conv2 && conv2->kind == ck_ambig) || (conv3 && conv3->kind == ck_ambig)) { - error ("operands to ?: have different types %qT and %qT", - arg2_type, arg3_type); + if (complain & tf_error) + error ("operands to ?: have different types %qT and %qT", + arg2_type, arg3_type); result = error_mark_node; } else if (conv2 && (!conv2->bad_p || !conv3)) @@ -4760,10 +4761,11 @@ build_conditional_expr_1 (tree arg1, tree arg2, tree arg3, /* In this case, there is always a common type. */ result_type = type_after_usual_arithmetic_conversions (arg2_type, arg3_type); - do_warn_double_promotion (result_type, arg2_type, arg3_type, - "implicit conversion from %qT to %qT to " - "match other result of conditional", - input_location); + if (complain & tf_warning) + do_warn_double_promotion (result_type, arg2_type, arg3_type, + "implicit conversion from %qT to %qT to " + "match other result of conditional", + input_location); if (TREE_CODE (arg2_type) == ENUMERAL_TYPE && TREE_CODE (arg3_type) == ENUMERAL_TYPE) @@ -6790,9 +6792,14 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain) /* Check that the base class is accessible. */ if (!accessible_base_p (TREE_TYPE (argtype), BINFO_TYPE (cand->conversion_path), true)) - error ("%qT is not an accessible base of %qT", - BINFO_TYPE (cand->conversion_path), - TREE_TYPE (argtype)); + { + if (complain & tf_error) + error ("%qT is not an accessible base of %qT", + BINFO_TYPE (cand->conversion_path), + TREE_TYPE (argtype)); + else + return error_mark_node; + } /* If fn was found by a using declaration, the conversion path will be to the derived class, not the base declaring fn. We must convert from derived to base. */ |