Nested class forwarded definition: Not supported.
Markus Schutz
markus.schutz@a2i.ch
Fri Feb 19 03:24:00 GMT 1999
I found the following unsuported feature in EGCS-1.1.1:
Nested class forwarded definition is not supported.
I quote Stroustrup:
"Like other members, a member class (often called a nested class) can be
declared in the class itself and defined later:"
It's in Chapter 11, Section 11.12, p. 293 of:
"C++ Programming Language (Third Edition)", Bjarne Stroustrup, Addison
Wesley, 1998, ISBN 0-201-88954-4.
I know it is possible to put the definition of the nested class in the
class itself, but this reduces readability. I think there is some type
checking that should be a little bit relaxed when in class definition.
EGCS-1.1.1
gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
GNU CPP version egcs-2.91.60 19981201 (egcs-1.1.1 release) (i386
Linux/ELF)
System: Linux-2.1.125 (not important)
g++ -v --save-temps forward.C
forward.C:12: field `n' has incomplete type
forward.C: (attached)
The example source file for "later define of nested class".
forward.ii: (attached)
The preprocessed output.
Regards,
Markus
--
------------------------------------------------------------------------
Markus Schütz R&D Engineer
a2i SA axsNOWî Division
3, Ch. de Mornex Phone: ++41 21 311 5634
1003 Lausanne Fax: ++41 21 311 5660
Switzerland mailto:markus.schutz@a2i.ch
http://www.axsnow.com
------------------------------------------------------------------------
class Base
{
public:
class Nested;
public:
~Base ();
Base ();
Base (const Base& b);
private:
Nested n;
};
class Base::Nested
{
public:
~Nested ();
Nested ();
Nested (const Nested& n);
};
main ()
{
Base mb;
}
More information about the Gcc-bugs
mailing list