This code is accepted by GCC and compiles typedef void F(); struct X { F X; };
Not valid according to 9.2/13bullet2. It seems that GCC thinks that "F X;" is a data-member (declaring data-members with the name of the class is valid, as long as there are no user declared constructors). -- Summary: GCC allows declaring a function having the name of the class using a typedef Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: schaub-johannes at web dot de GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44400