diff options
author | Marek Polacek <polacek@redhat.com> | 2017-02-10 16:33:45 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2017-02-10 16:33:45 +0000 |
commit | 3799a5b853ef08d781407009427f9ddc9a6ec7be (patch) | |
tree | a4bcc54abde1d36997602780f82030ac500335ec /gcc/cp/cvt.c | |
parent | 6f4f30bf3142fe3454345be587b373aa457078d3 (diff) | |
download | gcc-3799a5b853ef08d781407009427f9ddc9a6ec7be.zip gcc-3799a5b853ef08d781407009427f9ddc9a6ec7be.tar.gz gcc-3799a5b853ef08d781407009427f9ddc9a6ec7be.tar.bz2 |
re PR c++/79184 (-Wint-in-bool-context triggered erroneously in template parameter)
PR c++/79184
* cvt.c (ocp_convert): Add a sentinel against -Wint-in-bool-context
if warnings shouldn't be given.
* g++.dg/warn/Wint-in-bool-context-1.C: New.
From-SVN: r245335
Diffstat (limited to 'gcc/cp/cvt.c')
-rw-r--r-- | gcc/cp/cvt.c | 10 |
1 files changed, 9 insertions, 1 deletions
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); |