cplusplus / cplusplus/draft

[class.mem] 9.2p1 should talk about member names instead of members? Members can be added later, names not.

Open
#1,074 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cwg
Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

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

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with [class.mem] 9.2p1 and 9.2p2, then compare their statements with the member-template specialization examples in the issue. Determine wording that distinguishes the complete set of member names from specializations declared later; done means the paragraphs no longer contradict those cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.