Improve certain definitions in [class.mem.general]
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
NO.1
A direct member of a class X is a member of X that was first declared within the member-specification of X
Consider this example
struct X{
struct Nested{
int a;
};
};
Since the class-specifier of Nested is within the member-specification of X, thus every member-specification within Nested is also within the member-specification of X and also first be declared. That is not intent of the rule, any intervening class-specifier should abort the application of the definition. So, the improvement for this rule is that:
A direct member of a class X is a member of X that was first declared within the member-specification of X and the innermost class-specifier enclosing that member-specification is X's.
NO.2
[class.mem.general] p21
If T is the name of a class, then each of the following shall have a name different from T:
- every static data member of class T;
- every member function of class T;
- every member of class T that is itself a type;
- every member template of class T;
- every enumerator of every member of class T that is an unscoped enumerated type; and
- every member of every anonymous union that is a member of class T.
Since [class.derived.general] p2 says
Members of a base class are also members of the derived class.
Obviously, the intent of the above bullets should refer to the direct member of class T.
NO.3
Consider the third bullet in the above list
every member of class T that is itself a type;
How about injected-class-name?
The class-name is also bound in the scope of the class (template) itself; this is known as the injected-class-name. For purposes of access checking, the injected-class-name is treated as if it were a public member name.
[basic.scope.pdecl] p8
The locus of an injected-class-name declaration ([class.pre]) is immediately following the opening brace of the class definition.
[class.mem.general] p1
The member-specification in a class definition declares the full set of members of the class; no member can be added elsewhere.
So, the injected-class-name is a member, and the declaration associated with it has a locus, which admits it should have a declaration. Furthermore, no member can be added elsewhere, thus, it should act as a member declaration, as it is a member. Hence, the third bullet should exclude this special case. Moreover, an additional improvement to the third bullet is that
every member of class T that itself denotes a type
Since we have a clear definition regarding denote an entity in [basic.pre] p5
An entity E is denoted by the name (if any) that is introduced by a declaration of E or by a typedef-name introduced by a declaration specifying E.
The improvement will cover two cases that either the member declaration itself introduces a type or the member declaration itself introduces a typedef-name to denote the type instead of introducing a new type.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the draft source for [class.mem.general] and read the surrounding definitions and bullets. Compare the wording against the nested-class, derived-class, anonymous-union, and injected-class-name cases described here; done means the relevant definitions express the intended direct-member and type-denoting distinctions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, tex
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100