Debian Codegraph @

clang/test/Sema/shift-bool.c

raw
1 // RUN: %clang_cc1 -fsyntax-only -Wshift-bool -verify %s
2
3 void t() {
4 int x = 10;
5 int y = 5;
6
7 int a = (x < y) << 1;
8 int b = (x < y) >> 1;
9
10 int c = (x > y) << 1;
11 int d = (x > y) >> 1;
12
13 int e = (x == y) << 1;
14 int f = (x == y) >> 1;
15
16 int g = (x != y) << 1;
17 int h = (x != y) >> 1;
18
19 int i = (x < y) << 0;
20 int j = (x < y) >> 0;
21
22 int k = (x < y) << -1; // expected-warning {{shift count is negative}}
23 int l = (x < y) >> -1; // expected-warning {{shift count is negative}}
24
25 if (((x < y) << 1) != 0) { }
26 if (((x < y) >> 1) != 0) { }
27 }