2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.dg / opt / const3.C
bloba3539ab15c8b452a72344186b2377af16a7053be
1 // PR optimization/12926
2 // This failed on SPARC64 because the assignments to the bit-fields
3 // were wrongly swapped in the constructor.
5 // { dg-do run }
6 // { dg-options "-O2" }
8 extern void abort(void);
10 typedef __SIZE_TYPE__ size_t;
12 void *my_out;
14 struct A
16   enum Type {P, U, S};
18   int foo1(void *, const char *);
19   int foo2(int, const Type);
21   A (const size_t size, const Type type): mSize(size), mType(type)
22   {
23       foo2(foo1(my_out, "type = "), type);
24       foo2(foo1(my_out, "mType = "), mType);
25   }
27   const size_t mSize : 8*sizeof(size_t) - 3;
28   Type mType : 2;
31 int i;
33 int A::foo1(void *ios, const char *str) { }
34 int A::foo2(int v, const Type t) { i=0; }
36 int main()
38   A testa(2, A::S);
40   if (testa.mType != A::S)
41      abort();
43   return 0;