This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/19244] New: Typedef of anonymous class incorrectly handled in member function definition
- From: "austern at apple dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 3 Jan 2005 20:59:58 -0000
- Subject: [Bug c++/19244] New: Typedef of anonymous class incorrectly handled in member function definition
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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