You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"The member-specification in a class definition declares the full set
of members of the class; no member can be added elsewhere."
However in the same paragraph it contradicts this
"Members of a class are data members, member functions ([class.mfct]),
nested types, enumerators, and member templates ([temp.mem]) and
specializations thereof."
Specializations are added elsewhere as in the following example
class A { template<typename T> class X; };
template<> class A::X<int> {};
Here, a specialization of A::X is declared ouztside of the
member-specification and according to the same paragraph, the
specialization is a member. Another example with partial
specializations
class A { template<typename T> class X; };
template<typename T> class A::X<T*> { };
Here, a partial specialization is declared outside of the class, which
for partial specializations is valud. Because it's a member template,
and member templates according to that paragraph are members, here a
member is introduced outside of the member-specification aswell and
contradicts the paragraph directly.
Another rule at 9.2 that seems to be in error is 9.2p2 which says "...For any other member-declaration, each declared entity that is not an unnamed bit-field ([class.bit]) is a member of the class, and each such member-declaration shall either declare at least one member name of the class or declare at least one unnamed bit-field."
This indeed does not apply to partial specializations either. They do not introduce a member name. Albeit template-ids are names, they do not seem to be "introduced" by declarations the way other names are, since they are not found by name lookup.
The text was updated successfully, but these errors were encountered:
jensmaurer
changed the title
9.2p1 should talk about member names instead of members? Members can be added later, names not.
[class.mem] 9.2p1 should talk about member names instead of members? Members can be added later, names not.
Nov 22, 2016
Making specializations non-members would cause problems for the access control rules at least. I think 9.2/1 is really about member names, not members.
The spec says at 9.2p1
"The member-specification in a class definition declares the full set
of members of the class; no member can be added elsewhere."
However in the same paragraph it contradicts this
"Members of a class are data members, member functions ([class.mfct]),
nested types, enumerators, and member templates ([temp.mem]) and
specializations thereof."
Specializations are added elsewhere as in the following example
Here, a specialization of A::X is declared ouztside of the
member-specification and according to the same paragraph, the
specialization is a member. Another example with partial
specializations
Here, a partial specialization is declared outside of the class, which
for partial specializations is valud. Because it's a member template,
and member templates according to that paragraph are members, here a
member is introduced outside of the member-specification aswell and
contradicts the paragraph directly.
Another rule at 9.2 that seems to be in error is 9.2p2 which says "...For any other member-declaration, each declared entity that is not an unnamed bit-field ([class.bit]) is a member of the class, and each such member-declaration shall either declare at least one member name of the class or declare at least one unnamed bit-field."
This indeed does not apply to partial specializations either. They do not introduce a member name. Albeit template-ids are names, they do not seem to be "introduced" by declarations the way other names are, since they are not found by name lookup.
The text was updated successfully, but these errors were encountered: