From: Eli Friedman Date: Mon, 22 Jul 2013 23:30:13 +0000 (+0000) Subject: Testcase for PR16673. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=df88082fd50a0eb6ab2a4f21ed6c4df005700ec8;p=clang Testcase for PR16673. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186891 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/SemaCXX/warn-logical-not-compare.cpp b/test/SemaCXX/warn-logical-not-compare.cpp index 7e7e3a7592..3ecce474f1 100644 --- a/test/SemaCXX/warn-logical-not-compare.cpp +++ b/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; +}