1 // RUN: %clang_cc1 -fsyntax-only -verify -Wtautological-bitwise-compare %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -Wall -Wno-unused %s
3
test(int x)4 void test(int x) {
5 bool b1 = (8 & x) == 3;
6 // expected-warning@-1 {{bitwise comparison always evaluates to false}}
7 bool b2 = x | 5;
8 // expected-warning@-1 {{bitwise or with non-zero value always evaluates to true}}
9 bool b3 = (x | 5);
10 // expected-warning@-1 {{bitwise or with non-zero value always evaluates to true}}
11 bool b4 = !!(x | 5);
12 // expected-warning@-1 {{bitwise or with non-zero value always evaluates to true}}
13 }
14