blob: 4d14ad191e1ed2c8ad04baab767b22805fbaa9fb [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Douglas Gregor6f4a69a2009-07-06 15:38:40 +00002struct {unsigned x : 2;} x;
3__typeof__((x.x+=1)+1) y;
4__typeof__(x.x<<1) y;
5int y;
6
7
8struct { int x : 8; } x1;
9long long y1;
Eli Friedman04e83572009-08-20 04:21:42 +000010__typeof__(((long long)x1.x + 1)) y1;
11
12
13// Check for extensions: variously sized unsigned bit-fields fitting
14// into a signed int promote to signed int.
15enum E { ec1, ec2, ec3 };
16struct S {
17 enum E e : 2;
18 unsigned short us : 4;
19 unsigned long long ul1 : 8;
20 unsigned long long ul2 : 50;
21} s;
22
23__typeof(s.e + s.e) x_e;
24int x_e;
25
26__typeof(s.us + s.us) x_us;
27int x_us;
28
29__typeof(s.ul1 + s.ul1) x_ul1;
30int x_ul1;
31
32__typeof(s.ul2 + s.ul2) x_ul2;
33unsigned long long x_ul2;
34