2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.brendan / nest20.C
blob1b2c9419a6ac9a5f313e926a082420b6ca9980ca
1 // { dg-do assemble  }
2 // GROUPS passed nested-classes
3 // This is the first line of file ||t5.C||.
5 // This code initializing an unnamed union inside a class appears to
6 // be legal C++ input and compiles fine with AT&T cfront 3.0.1, but
7 // gcc 2.4.5 complains about multiple initializations of the same
8 // member.
10 class Expr {
11 public:
12     enum Type { undefined, slong, ulong, ldouble };
13     Expr();
14     Expr(Type type, const Expr* initializer);
15 private:
16     Type type_;
17     union {
18         long slong_;
19         unsigned long ulong_;
20         long double ldouble_;
21     };
24 // Construct an undefined expression.
26 Expr::Expr()
27     :
28     type_(undefined),
29     slong_(-1)