36 lines · c
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// expected-no-diagnostics3struct {unsigned x : 2;} x;4__typeof__((x.x+=1)+1) y;5__typeof__(x.x<<1) y;6int y;7 8 9struct { int x : 8; } x1;10long long y1;11__typeof__(((long long)x1.x + 1)) y1;12 13 14// Check for extensions: variously sized unsigned bit-fields fitting15// into a signed int promote to signed int.16enum E { ec1, ec2, ec3 };17struct 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;25int x_e;26 27__typeof(s.us + s.us) x_us;28int x_us;29 30__typeof(s.ul1 + s.ul1) x_ul1;31int x_ul1;32 33__typeof(s.ul2 + s.ul2) x_ul2;34unsigned long long x_ul2;35 36