* 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
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);
PR c++/79435
* g++.dg/cpp1y/pr79435.C: New.
+ PR c++/79184
+ * g++.dg/warn/Wint-in-bool-context-1.C: New.
+
2017-02-10 Christophe Lyon <christophe.lyon@linaro.org>
* gcc.target/aarch64/advsimd-intrinsics/p64_p128.c
--- /dev/null
+// PR c++/79184
+// { dg-do compile }
+// { dg-options "-Wint-in-bool-context" }
+
+enum { E = 2 };
+template <bool> void f(int) { }
+template <int> void f() {}
+
+int
+main ()
+{
+ f<1 * 1>(); // { dg-bogus "in boolean context" }
+ f<1 << 1>(); // { dg-bogus "in boolean context" }
+ f<1 ? 3 : 2>(); // { dg-bogus "in boolean context" }
+ f<E>(); // { dg-bogus "in boolean context" }
+}