2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.brendan / nest19.C
blob01ae3d002cd8557abf9fc6e4505572c846a67429
1 // { dg-do assemble  }
2 // GROUPS passed nested-classes
3 // This is the first line of file ||t3.C||.
5 // This code demonstrates a variation of the same problem with nested
6 // types.  In C++, nested typedefs are not supposed to be visible
7 // outside their class scopes but they apparently are in gcc 2.4.5.
8 // This code compiles fine in AT&T cfront 3.0.1, but gcc rejects it
9 // with the messages given below.
11 // If this class does not precede Expr, then the code will compile.
13 class Another {
14 public:
15     typedef int Boolean;
16     enum { FALSE, TRUE };
19 // If Expr does not define typedef int Boolean, then the code will
20 // compile.
22 class Expr {
23 public:
24     typedef int Boolean;
25     enum { FALSE, TRUE };
26     void foo();
27     void call_something_with(Boolean);
30 // t3.C: In method `void  Expr::foo ()':
31 //   t3.C:36: uninitialized const `Boolean'
32 //   t3.C:36: parse error before `='
33 //   t3.C:37: `argument' undeclared (first use this function)
34 //   t3.C:37: (Each undeclared identifier is reported only once
35 //   t3.C:37: for each function it appears in.)
37 void Expr::foo() {
38     const Boolean argument = TRUE;
39     call_something_with(argument);