aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/cvt.c10
2 files changed, 13 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7f113ec..5ea0c93 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -4,6 +4,10 @@
* pt.c (type_dependent_expression_p): Check if the expression type
is null.
+ PR c++/79184
+ * cvt.c (ocp_convert): Add a sentinel against -Wint-in-bool-context
+ if warnings shouldn't be given.
+
2017-02-10 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/71737
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index ae9991a..5f4b5e3 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -798,7 +798,15 @@ ocp_convert (tree type, tree expr, int convtype, int flags,
to the underlying type first. */
if (SCOPED_ENUM_P (intype) && (convtype & CONV_STATIC))
e = build_nop (ENUM_UNDERLYING_TYPE (intype), e);
- return cp_truthvalue_conversion (e);
+ if (complain & tf_warning)
+ return cp_truthvalue_conversion (e);
+ else
+ {
+ /* Prevent bogus -Wint-in-bool-context warnings coming
+ from c_common_truthvalue_conversion down the line. */
+ warning_sentinel w (warn_int_in_bool_context);
+ return cp_truthvalue_conversion (e);
+ }
}
converted = convert_to_integer_maybe_fold (type, e, dofold);