aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.8.1/gcc/testsuite/g++.dg/init/bitfield1.C
blob: 70a06d0e144569db4d1b3ca6c1e9b62d5be38b4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Check that we handle bitfields as complex lvalues properly.

struct A
{
  int i: 2;
  int j: 2;
  int k: 2;
};

A a, a2;
bool b;
void f ();

int main ()
{
  (f(), a.j) = 1;
  (f(), a).j = 2; // { dg-warning "overflow" } 
  (b ? a.j : a2.k) = 3; // { dg-warning "overflow" } 
  (b ? a : a2).j = 0;
  ++(a.j) = 1;
  (a.j = 2) = 3; // { dg-warning "overflow" } 
}