1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
2 | // expected-no-diagnostics |
3 | struct {unsigned x : 2;} x; |
4 | __typeof__((x.x+=1)+1) y; |
5 | __typeof__(x.x<<1) y; |
6 | int y; |
7 | |
8 | |
9 | struct { int x : 8; } x1; |
10 | long long y1; |
11 | __typeof__(((long long)x1.x + 1)) y1; |
12 | |
13 | |
14 | // Check for extensions: variously sized unsigned bit-fields fitting |
15 | // into a signed int promote to signed int. |
16 | enum E { ec1, ec2, ec3 }; |
17 | struct S { |
18 | enum E e : 2; |
19 | unsigned short us : 4; |
20 | unsigned long long ul1 : 8; |
21 | unsigned long long ul2 : 50; |
22 | } s; |
23 | |
24 | __typeof(s.e + s.e) x_e; |
25 | int x_e; |
26 | |
27 | __typeof(s.us + s.us) x_us; |
28 | int x_us; |
29 | |
30 | __typeof(s.ul1 + s.ul1) x_ul1; |
31 | int x_ul1; |
32 | |
33 | __typeof(s.ul2 + s.ul2) x_ul2; |
34 | unsigned long long x_ul2; |
35 | |
36 | |