2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.brendan / nest18.C
blobe62382781d106bd7569bd88c1ea8864163b24272
1 // { dg-do assemble  }
2 // GROUPS passed nested-classes
3 // This is the first line of file ||t2.C||.
5 // This code demonstrates what appears to be a bug with nested types.
6 // In C++, nested typedefs are not supposed to be visible outside
7 // their class scopes but they apparently are in gcc 2.4.5.  This code
8 // compiles fine in AT&T cfront 3.0.1, but will not compile with gcc.
10 // If this class does not precede String, then the code will compile.
12 class Another {
13 public:
14     typedef int Length;
17 // If String does not define typedef int Length, then the code will
18 // compile.
20 class String {
21 public:
22     typedef int Length;         // remove this and it will compile fine
24     int foo(Length length) const;
27 int String::foo(Length length) const {
28     return length;
31 // File ||t2.C|| ends here.