This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Syntax error on use of embedded structure definition.
- To: gcc-bugs at gcc dot gnu dot org
- Subject: Syntax error on use of embedded structure definition.
- From: Karl Nelson <kenelson at ece dot ucdavis dot edu>
- Date: Sat, 12 Aug 2000 08:16:57 -0700
- cc: kenelson at elm dot ece dot ucdavis dot edu
Category: c++
Synopsis: Syntax error on use of embedded structure definition.
Class: rejects-legal
Release: gcc-2.95.2
Environment: all (linux, hpux, sun tested)
Description:
If a structure is defined within a class and a member of that
type declared following that definition a syntax error will
be reported of "semicolon missing after declaration" when that
member is defined later.
I am not sure this is legal code but the error issued is certainly
not correct. Separating the declaration of the member from
the definition of the embedded class fixes the error.
How-To-Repeat:
struct Foo {
struct Bar {
Bar();
~Bar();
} bar();
Foo();
};
Foo::Bar::Bar() {}
Foo::Bar::~Bar() {}
Foo::Bar Foo::bar() {}
Foo::Foo() {}