This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Syntax error on use of embedded structure definition.



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() {}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]