------- Comment #2 from manu at gcc dot gnu dot org 2010-02-20 18:19 ------- Jason, do we want this?
It seems trivial: Index: gcc/cp/typeck.c =================================================================== --- gcc/cp/typeck.c (revision 156923) +++ gcc/cp/typeck.c (working copy) @@ -6260,10 +6260,20 @@ cp_build_c_cast (tree type, tree expr, t if (complain & tf_error) error ("invalid cast to function type %qT", type); return error_mark_node; } + + if (TREE_CODE (type) == POINTER_TYPE + && TREE_CODE (TREE_TYPE (value)) == INTEGER_TYPE + && TYPE_PRECISION (type) != TYPE_PRECISION (TREE_TYPE (value)) + /* Don't warn about converting any constant. */ + && !TREE_CONSTANT (value)) + warning_at (loc, + OPT_Wint_to_pointer_cast, "cast to pointer from integer " + "of different size"); + /* A C-style cast can be a const_cast. */ result = build_const_cast_1 (type, value, /*complain=*/false, &valid_p); if (valid_p) return result; -- manu at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at redhat dot com, | |manu at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28584