diff options
author | Marek Polacek <polacek@redhat.com> | 2014-08-22 19:44:27 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2014-08-22 19:44:27 +0000 |
commit | 59ea036456a663cb19a4f5a03c0643bd66f55b30 (patch) | |
tree | 172770434748d3c011b458569b6b2790b8b20842 /gcc/testsuite/c-c++-common/pr62199-2.c | |
parent | e0bf0dc2c0c17dd4fa6f76c87411906c33dfc3ce (diff) | |
download | gcc-59ea036456a663cb19a4f5a03c0643bd66f55b30.zip gcc-59ea036456a663cb19a4f5a03c0643bd66f55b30.tar.gz gcc-59ea036456a663cb19a4f5a03c0643bd66f55b30.tar.bz2 |
re PR c++/62199 (ICE with -Wlogical-not-parentheses)
PR c++/62199
* doc/invoke.texi: Update -Wlogical-not-parentheses description.
c-family/
* c-common.c (warn_logical_not_parentheses): Don't check LHS. Don't
check for vector types. Drop LHS argument.
* c-common.h (warn_logical_not_parentheses): Adjust.
c/
* c-typeck.c (parser_build_binary_op): Adjust call to
warn_logical_not_parentheses.
cp/
* parser.c (cp_parser_binary_expression): Check each LHS if it's
preceded with logical not. Adjust call to
warn_logical_not_parentheses.
testsuite/
* c-c++-common/pr62199.c: New test.
* c-c++-common/pr62199-2.c: New test.
* g++.dg/warn/Wparentheses-25.C: Drop XFAILs.
From-SVN: r214360
Diffstat (limited to 'gcc/testsuite/c-c++-common/pr62199-2.c')
-rw-r--r-- | gcc/testsuite/c-c++-common/pr62199-2.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/pr62199-2.c b/gcc/testsuite/c-c++-common/pr62199-2.c new file mode 100644 index 0000000..7647f16 --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr62199-2.c @@ -0,0 +1,20 @@ +/* PR c++/62199 */ +/* { dg-do compile } */ +/* { dg-options "-Wlogical-not-parentheses" } */ + +#ifndef __cplusplus +# define bool _Bool +#endif + +bool r; + +void +foo (bool b) +{ + r = !b == 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ + r = !b != 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ + r = !b > 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ + r = !b >= 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ + r = !b < 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ + r = !b <= 1; /* { dg-warning "logical not is only applied to the left hand side of comparison" } */ +} |