gcc 4.0 incorrectly rejects the following valid code: typedef struct { void f(); } f; void f::f() { }
It treats f::f as referring to a constructor, and then gets confused because this isn't the right syntax for a constructor definition. However (12.1/3), "a typedef-name that names a class shall not be used as the identifier in the declarator for a constructor declaration." Note that this only happens for an anonymous class. If I instead write typedef struct e { void f(); } f; then this compiles without error. This is a regression. 3.3 handles this correctly. -- Summary: Typedef of anonymous class incorrectly handled in member function definition Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: austern at apple dot com CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: powerpc-apple-darwin7.7.0 GCC host triplet: powerpc-apple-darwin7.7.0 GCC target triplet: powerpc-apple-darwin7.7.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19244