| // RUN: %clang_cc1 -x c -fsyntax-only -verify -Wtautological-constant-compare %s |
| // RUN: %clang_cc1 -x c -fsyntax-only -verify %s |
| // RUN: %clang_cc1 -x c++ -fsyntax-only -verify -Wtautological-constant-compare %s |
| // RUN: %clang_cc1 -x c++ -fsyntax-only -verify %s |
| #define TERN(c, l, r) c ? l : r |
| r = a ? 3 : TWO; // expected-warning {{converting the result of '?:' with integer constants to a boolean always evaluates to 'true'}} |
| r = a ? 3 : -2; // expected-warning {{converting the result of '?:' with integer constants to a boolean always evaluates to 'true'}} |
| r = a ? 3 : ONE; // expected-warning {{converting the result of '?:' with integer constants to a boolean always evaluates to 'true'}} |
| r = TERN(a, 4, 8); // expected-warning {{converting the result of '?:' with integer constants to a boolean always evaluates to 'true'}} |
| r = TERN(a, -1, -8); // expected-warning {{converting the result of '?:' with integer constants to a boolean always evaluates to 'true'}} |