http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46589
Kai Tietz <ktietz at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ktietz at gcc dot gnu.org --- Comment #7 from Kai Tietz <ktietz at gcc dot gnu.org> 2011-01-02 14:29:18 UTC --- (In reply to comment #3) > I'm not sure if [basic.link] paragraph 5 means S::f should have external > linkage or not. Paragraph 4 (third bullet) means that S has external linkage. > Paragraph 5 refers to the name of the class and in this case the class has no > name, but it has the typedef name for linkage purposes. I'm not sure if that > means S::f should or should not have external linkage. As far as I understand specificiation (C++ Standard - ANSI ISO IEC 14882 2003) 3.5 Program and linkage 3 Basic concepts --- an object or reference that is explicitly declared const and neither explicitly declared extern nor previously declared to have external linkage; or --- a data member of an anonymous union. 4 A name having namespace scope has external linkage if it is the name of --- an object or reference, unless it has internal linkage; or --- a function, unless it has internal linkage; or --- a named class (clause 9), or an unnamed class defined in a typedef declaration in which the class has the typedef name for linkage purposes (7.1.3); or --- a named enumeration (7.2), or an unnamed enumeration defined in a typedef declaration in which the enumeration has the typedef name for linkage purposes (7.1.3); or --- an enumerator belonging to an enumeration with external linkage; or --- a template, unless it is a function template that has internal linkage (clause 14); or --- a namespace (7.3), unless it is declared within an unnamed namespace. 5 In addition, a member function, static data member, class or enumeration of class scope has external linkage if the name of the class has external linkage. 7.1.3 ... If the typedef declaration defines an unnamed class (or enum), the first typedef-name declared by the declaration to be that class type (or enum type) is used to denote the class type (or enum type) for linkage purposes only (3.5). [Example:] typedef struct { } *ps, S; // S is the class name for linkage purposes [end example] ... So S becomes here class name and the class S has external linkage. So member functions of it, too. Just explicit constructor/destructors aren't possible here, as S() would be a normal method and needs a return type. Kai