diff options
| -rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
| -rw-r--r-- | gcc/cp/cvt.c | 6 | ||||
| -rw-r--r-- | gcc/cp/typeck.c | 2 |
3 files changed, 12 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6369f05..4934577 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2013-11-10 Paolo Carlini <paolo.carlini@oracle.com> + + * cvt.c (cp_convert_to_pointer): Call build_ptrmemfunc before + maybe_warn_zero_as_null_pointer_constant to avoid duplicate + -Wzero-as-null-pointer-constant diagnostics. + + * typeck.c (build_ptrmemfunc): Use cp_build_c_cast. + 2013-11-06 Paolo Carlini <paolo.carlini@oracle.com> PR c++/11006 diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 08c026d..7dac108 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -203,13 +203,13 @@ cp_convert_to_pointer (tree type, tree expr, tsubst_flags_t complain) if (null_ptr_cst_p (expr)) { - if (complain & tf_warning) - maybe_warn_zero_as_null_pointer_constant (expr, loc); - if (TYPE_PTRMEMFUNC_P (type)) return build_ptrmemfunc (TYPE_PTRMEMFUNC_FN_TYPE (type), expr, 0, /*c_cast_p=*/false, complain); + if (complain & tf_warning) + maybe_warn_zero_as_null_pointer_constant (expr, loc); + /* A NULL pointer-to-data-member is represented by -1, not by zero. */ tree val = (TYPE_PTRDATAMEM_P (type) diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index bcb8782..bff7f17 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -7779,7 +7779,7 @@ build_ptrmemfunc (tree type, tree pfn, int force, bool c_cast_p, /* Handle null pointer to member function conversions. */ if (null_ptr_cst_p (pfn)) { - pfn = build_c_cast (input_location, type, pfn); + pfn = cp_build_c_cast (type, pfn, complain); return build_ptrmemfunc1 (to_type, integer_zero_node, pfn); |
