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