r186891 - Testcase for PR16673.

Eli Friedman eli.friedman at gmail.com
Mon Jul 22 16:30:13 PDT 2013


Author: efriedma
Date: Mon Jul 22 18:30:13 2013
New Revision: 186891

URL: http://llvm.org/viewvc/llvm-project?rev=186891&view=rev
Log:
Testcase for PR16673.

Modified:
    cfe/trunk/test/SemaCXX/warn-logical-not-compare.cpp

Modified: cfe/trunk/test/SemaCXX/warn-logical-not-compare.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-logical-not-compare.cpp?rev=186891&r1=186890&r2=186891&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-logical-not-compare.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-logical-not-compare.cpp Mon Jul 22 18:30:13 2013
@@ -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 at -1 {{logical not is only applied to the left hand side of this comparison}}
+  // expected-note at -2 {{add parentheses after the '!' to evaluate the comparison first}}
+  // expected-note at -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;
+}





More information about the cfe-commits mailing list