]> granicus.if.org Git - clang/commitdiff
Testcase for PR16673.
authorEli Friedman <eli.friedman@gmail.com>
Mon, 22 Jul 2013 23:30:13 +0000 (23:30 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Mon, 22 Jul 2013 23:30:13 +0000 (23:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186891 91177308-0d34-0410-b5e6-96231b3b80d8

test/SemaCXX/warn-logical-not-compare.cpp

index 7e7e3a759225d2b120ddd69b36d8dca2b27d8a5b..3ecce474f1499f92b2e94417e31a49f48812cb00 100644 (file)
@@ -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;
+}