diff options
author | rdivacky <rdivacky@FreeBSD.org> | 2010-05-04 16:12:48 +0000 |
---|---|---|
committer | rdivacky <rdivacky@FreeBSD.org> | 2010-05-04 16:12:48 +0000 |
commit | 8aaf5818a64e9f7687798852af5945b053c68a54 (patch) | |
tree | d6a70c3518b8dea8be7062438d7e8676820ed17f /test/SemaCXX/warn-assignment-condition.cpp | |
parent | 71438373cd57f0d5d8c93bb5cf690844a0fbc9d0 (diff) | |
download | FreeBSD-src-8aaf5818a64e9f7687798852af5945b053c68a54.zip FreeBSD-src-8aaf5818a64e9f7687798852af5945b053c68a54.tar.gz |
Update clang to r103004.
Diffstat (limited to 'test/SemaCXX/warn-assignment-condition.cpp')
-rw-r--r-- | test/SemaCXX/warn-assignment-condition.cpp | 49 |
1 files changed, 33 insertions, 16 deletions
diff --git a/test/SemaCXX/warn-assignment-condition.cpp b/test/SemaCXX/warn-assignment-condition.cpp index ce16a68..e5a3425 100644 --- a/test/SemaCXX/warn-assignment-condition.cpp +++ b/test/SemaCXX/warn-assignment-condition.cpp @@ -12,33 +12,42 @@ void test() { // With scalars. if (x = 7) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \ - // expected-note{{use '==' to turn this assignment into an equality comparison}} + // expected-note{{use '==' to turn this assignment into an equality comparison}} \ + // expected-note{{place parentheses around the assignment to silence this warning}} if ((x = 7)) {} do { } while (x = 7); // expected-warning {{using the result of an assignment as a condition without parentheses}} \ - // expected-note{{use '==' to turn this assignment into an equality comparison}} + // expected-note{{use '==' to turn this assignment into an equality comparison}} \ + // expected-note{{place parentheses around the assignment to silence this warning}} do { } while ((x = 7)); while (x = 7) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \ - // expected-note{{use '==' to turn this assignment into an equality comparison}} + // expected-note{{use '==' to turn this assignment into an equality comparison}} \ + // expected-note{{place parentheses around the assignment to silence this warning}} + while ((x = 7)) {} for (; x = 7; ) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \ - // expected-note{{use '==' to turn this assignment into an equality comparison}} + // expected-note{{use '==' to turn this assignment into an equality comparison}} \ + // expected-note{{place parentheses around the assignment to silence this warning}} for (; (x = 7); ) {} if (p = p) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \ - // expected-note{{use '==' to turn this assignment into an equality comparison}} + // expected-note{{use '==' to turn this assignment into an equality comparison}} \ + // expected-note{{place parentheses around the assignment to silence this warning}} if ((p = p)) {} do { } while (p = p); // expected-warning {{using the result of an assignment as a condition without parentheses}} \ - // expected-note{{use '==' to turn this assignment into an equality comparison}} + // expected-note{{use '==' to turn this assignment into an equality comparison}} \ + // expected-note{{place parentheses around the assignment to silence this warning}} do { } while ((p = p)); while (p = p) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \ - // expected-note{{use '==' to turn this assignment into an equality comparison}} + // expected-note{{use '==' to turn this assignment into an equality comparison}} \ + // expected-note{{place parentheses around the assignment to silence this warning}} while ((p = p)) {} for (; p = p; ) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \ - // expected-note{{use '==' to turn this assignment into an equality comparison}} + // expected-note{{use '==' to turn this assignment into an equality comparison}} \ + // expected-note{{place parentheses around the assignment to silence this warning}} for (; (p = p); ) {} // Initializing variables (shouldn't warn). @@ -49,33 +58,41 @@ void test() { // With temporaries. if (x = (b+b).foo()) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \ - // expected-note{{use '==' to turn this assignment into an equality comparison}} + // expected-note{{use '==' to turn this assignment into an equality comparison}} \ + // expected-note{{place parentheses around the assignment to silence this warning}} if ((x = (b+b).foo())) {} do { } while (x = (b+b).foo()); // expected-warning {{using the result of an assignment as a condition without parentheses}} \ - // expected-note{{use '==' to turn this assignment into an equality comparison}} + // expected-note{{use '==' to turn this assignment into an equality comparison}} \ + // expected-note{{place parentheses around the assignment to silence this warning}} do { } while ((x = (b+b).foo())); while (x = (b+b).foo()) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \ - // expected-note{{use '==' to turn this assignment into an equality comparison}} + // expected-note{{use '==' to turn this assignment into an equality comparison}} \ + // expected-note{{place parentheses around the assignment to silence this warning}} while ((x = (b+b).foo())) {} for (; x = (b+b).foo(); ) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \ - // expected-note{{use '==' to turn this assignment into an equality comparison}} + // expected-note{{use '==' to turn this assignment into an equality comparison}} \ + // expected-note{{place parentheses around the assignment to silence this warning}} for (; (x = (b+b).foo()); ) {} // With a user-defined operator. if (a = b + b) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \ - // expected-note{{use '==' to turn this assignment into an equality comparison}} + // expected-note{{use '==' to turn this assignment into an equality comparison}} \ + // expected-note{{place parentheses around the assignment to silence this warning}} if ((a = b + b)) {} do { } while (a = b + b); // expected-warning {{using the result of an assignment as a condition without parentheses}} \ - // expected-note{{use '==' to turn this assignment into an equality comparison}} + // expected-note{{use '==' to turn this assignment into an equality comparison}} \ + // expected-note{{place parentheses around the assignment to silence this warning}} do { } while ((a = b + b)); while (a = b + b) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \ - // expected-note{{use '==' to turn this assignment into an equality comparison}} + // expected-note{{use '==' to turn this assignment into an equality comparison}} \ + // expected-note{{place parentheses around the assignment to silence this warning}} while ((a = b + b)) {} for (; a = b + b; ) {} // expected-warning {{using the result of an assignment as a condition without parentheses}} \ - // expected-note{{use '==' to turn this assignment into an equality comparison}} + // expected-note{{use '==' to turn this assignment into an equality comparison}} \ + // expected-note{{place parentheses around the assignment to silence this warning}} for (; (a = b + b); ) {} } |