1 // RUN: %clang_cc1 -fsyntax-only -verify -Wtautological-bitwise-compare %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -Wall -Wno-unused %s
5 bool b1
= (8 & x
) == 3;
6 // expected-warning@-1 {{bitwise comparison always evaluates to false}}
8 // expected-warning@-1 {{bitwise or with non-zero value always evaluates to true}}
10 // expected-warning@-1 {{bitwise or with non-zero value always evaluates to true}}
12 // expected-warning@-1 {{bitwise or with non-zero value always evaluates to true}}
15 template <int I
, class T
> // silence
17 bool b1
= (x
& sizeof(T
)) == 8;
18 bool b2
= (x
& I
) == 8;
19 bool b3
= (x
& 4) == 8; // expected-warning {{bitwise comparison always evaluates to false}}
23 foo
<4, int>(8); // expected-note {{in instantiation of function template specialization 'foo<4, int>' requested here}}