aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8/gcc/cp/cvt.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.8/gcc/cp/cvt.c')
-rw-r--r--gcc-4.8/gcc/cp/cvt.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc-4.8/gcc/cp/cvt.c b/gcc-4.8/gcc/cp/cvt.c
index 8c03e2086..179650711 100644
--- a/gcc-4.8/gcc/cp/cvt.c
+++ b/gcc-4.8/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)
@@ -743,6 +743,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
unspecified. */
if ((complain & tf_warning)
&& TREE_CODE (e) == INTEGER_CST
+ && ENUM_UNDERLYING_TYPE (type)
&& !int_fits_type_p (e, ENUM_UNDERLYING_TYPE (type)))
warning_at (loc, OPT_Wconversion,
"the result of the conversion is unspecified because "