diff options
Diffstat (limited to 'gcc/cp/cvt.c')
-rw-r--r-- | gcc/cp/cvt.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c index 4e628a5..947f1f2 100644 --- a/gcc/cp/cvt.c +++ b/gcc/cp/cvt.c @@ -593,6 +593,29 @@ cp_convert (tree type, tree expr) return ocp_convert (type, expr, CONV_OLD_CONVERT, LOOKUP_NORMAL); } +/* C++ equivalent of convert_and_check but using cp_convert as the + conversion function. + + Convert EXPR to TYPE, warning about conversion problems with constants. + Invoke this function on every expression that is converted implicitly, + i.e. because of language rules and not because of an explicit cast. */ + +tree +cp_convert_and_check (tree type, tree expr) +{ + tree result; + + if (TREE_TYPE (expr) == type) + return expr; + + result = cp_convert (type, expr); + + if (!skip_evaluation && !TREE_OVERFLOW_P (expr)) + warnings_for_convert_and_check (type, expr, result); + + return result; +} + /* Conversion... FLAGS indicates how we should behave. */ |