diff options
-rw-r--r-- | clang/test/SemaCXX/warn-logical-not-compare.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/warn-logical-not-compare.cpp b/clang/test/SemaCXX/warn-logical-not-compare.cpp index 7e7e3a75922..3ecce474f14 100644 --- a/clang/test/SemaCXX/warn-logical-not-compare.cpp +++ b/clang/test/SemaCXX/warn-logical-not-compare.cpp @@ -177,3 +177,18 @@ bool test2 (E e) { return ret; } + +bool PR16673(int x) { + bool ret; + // Make sure we don't emit a fixit for the left paren, but not the right paren. +#define X(x) x + ret = X(!x == 1 && 1); + // expected-warning@-1 {{logical not is only applied to the left hand side of this comparison}} + // expected-note@-2 {{add parentheses after the '!' to evaluate the comparison first}} + // expected-note@-3 {{add parentheses around left hand side expression to silence this warning}} + // CHECK: to evaluate the comparison first + // CHECK-NOT: fix-it + // CHECK: to silence this warning + // CHECK-NOT: fix-it + return ret; +} |