Allow resolving headers from a PCH even after headers+PCH were moved to another path.
[clang.git] / test / Sema / shift.c
blob4273cab98ee39b23a547b3372435ca896aa032ab
1 // RUN: %clang -Wall -ffreestanding -fsyntax-only -Xclang -verify %s
3 #include <limits.h>
5 enum {
6 X = 1 << 0,
7 Y = 1 << 1,
8 Z = 1 << 2
9 };
11 void test() {
12 char c;
14 c = 0 << 0;
15 c = 0 << 1;
16 c = 1 << 0;
17 c = 1 << -0;
18 c = 1 >> -0;
19 c = 1 << -1; // expected-warning {{shift count is negative}}
20 c = 1 >> -1; // expected-warning {{shift count is negative}}
21 c = 1 << c;
22 c <<= 0;
23 c >>= 0;
24 c <<= 1;
25 c >>= 1;
26 c <<= -1; // expected-warning {{shift count is negative}}
27 c >>= -1; // expected-warning {{shift count is negative}}
28 c <<= 999999; // expected-warning {{shift count >= width of type}}
29 c >>= 999999; // expected-warning {{shift count >= width of type}}
30 c <<= CHAR_BIT; // expected-warning {{shift count >= width of type}}
31 c >>= CHAR_BIT; // expected-warning {{shift count >= width of type}}
32 c <<= CHAR_BIT+1; // expected-warning {{shift count >= width of type}}
33 c >>= CHAR_BIT+1; // expected-warning {{shift count >= width of type}}
34 (void)((long)c << CHAR_BIT);
37 #define a 0
38 #define ashift 8
39 enum { b = (a << ashift) };