FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.dg / lookup / anon1.C
blobe4db50d946cb6312aa867a057be88114b3171540
1 // PR c++/2039
2 // Test that a scoped reference to a member of an anonymous union member of
3 // a base class works properly.
5 // { dg-do run }
7 struct A
9   long ia1;
10   union
11   {
12     long ia2;
13   };
16 struct B : public A
18   void f1();
19   void f2();
22 void B::f1()
24   ia1 = 11;
25   ia2 = 22;
28 void B::f2()
30   ia1    = 33;
31   A::ia2 = 44;   // <<< !!!????
34 int main()
36   B x;
38   x.f1();
39   if (x.ia1 != 11 || x.ia2 != 22)
40     return 1;
42   x.f2();
43   if (x.ia1 != 33 || x.ia2 != 44)
44     return 1;
46   return 0;