diff options
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 9d25298..8218ed4 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4245,11 +4245,12 @@ build_temp (tree expr, tree type, int flags, return expr; } -/* Perform warnings about conversion of EXPR to type TOTYPE. +/* Perform warnings about peculiar, but valid, conversions from/to NULL. + EXPR is implicitly converted to type TOTYPE. FN and ARGNUM are used for diagnostics. */ static void -convert_conversion_warnings (tree totype, tree expr, tree fn, int argnum) +conversion_null_warnings (tree totype, tree expr, tree fn, int argnum) { tree t = non_reference (totype); @@ -4263,19 +4264,8 @@ convert_conversion_warnings (tree totype, tree expr, tree fn, int argnum) warning (OPT_Wconversion, "converting to non-pointer type %qT from NULL", t); } - /* Warn about assigning a floating-point type to an integer type. */ - if (TREE_CODE (TREE_TYPE (expr)) == REAL_TYPE - && TREE_CODE (t) == INTEGER_TYPE) - { - if (fn) - warning (OPT_Wconversion, "passing %qT for argument %P to %qD", - TREE_TYPE (expr), argnum, fn); - else - warning (OPT_Wconversion, "converting to %qT from %qT", t, TREE_TYPE (expr)); - } - /* Issue warnings if "false" is converted to a NULL pointer */ - if (expr == boolean_false_node && fn && POINTER_TYPE_P (t)) + else if (expr == boolean_false_node && fn && POINTER_TYPE_P (t)) warning (OPT_Wconversion, "converting %<false%> to pointer type for argument %P of %qD", argnum, fn); @@ -4328,7 +4318,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, } if (issue_conversion_warnings) - convert_conversion_warnings (totype, expr, fn, argnum); + conversion_null_warnings (totype, expr, fn, argnum); switch (convs->kind) { @@ -4415,7 +4405,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, expr = convert_like_real (convs->u.next, expr, fn, argnum, convs->kind == ck_ref_bind ? -1 : 1, - /*issue_conversion_warnings=*/false, + convs->kind == ck_ref_bind ? issue_conversion_warnings : false, c_cast_p); if (expr == error_mark_node) return error_mark_node; |