aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMarek Polacek <mpolacek@gcc.gnu.org>2017-09-01 09:22:57 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2017-09-01 09:22:57 +0000
commit8dc9277a90672a0b2d5a18bd989c6d99ca362746 (patch)
tree4bf5c53df1cabd08278d1fb21aca1d4ee366c4c0 /gcc/cp
parent61fae4b1db70f99aff3f75359abf3fcd6ad689a4 (diff)
downloadgcc-8dc9277a90672a0b2d5a18bd989c6d99ca362746.zip
gcc-8dc9277a90672a0b2d5a18bd989c6d99ca362746.tar.gz
gcc-8dc9277a90672a0b2d5a18bd989c6d99ca362746.tar.bz2
re PR c++/82040 (ICE with -Wbool-operation and ~)
PR c++/82040 * typeck.c (cp_build_unary_op): Avoid re-entering reporting routines. * g++.dg/warn/Wbool-operation-1.C: New test. From-SVN: r251581
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/typeck.c1
2 files changed, 6 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 4a791dd..e27f04c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2017-09-01 Marek Polacek <polacek@redhat.com>
+
+ PR c++/82040
+ * typeck.c (cp_build_unary_op): Avoid re-entering reporting routines.
+
2017-08-30 Jason Merrill <jason@redhat.com>
PR c++/82029 - __PRETTY_FUNCTION__ in lambda in template
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 171c2df..0a09998 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -5982,6 +5982,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, bool noconvert,
{
/* Warn if the expression has boolean value. */
if (TREE_CODE (TREE_TYPE (arg)) == BOOLEAN_TYPE
+ && (complain & tf_warning)
&& warning_at (location, OPT_Wbool_operation,
"%<~%> on an expression of type bool"))
inform (location, "did you mean to use logical not (%<!%>)?");