Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.brendan/nest20.C

raw
1 // { dg-do assemble }
2 // GROUPS passed nested-classes
3 // This is the first line of file ||t5.C||.
4
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.
9
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 };
22 };
23
24 // Construct an undefined expression.
25
26 Expr::Expr()
27 :
28 type_(undefined),
29 slong_(-1)
30 {}