Created on 2014-09-23.00:00:00 last changed 6 months ago
[Accepted at the November, 2020 meeting as part of paper P1787R6 and moved to DR at the February, 2021 meeting.]
Point 2 of the rules of class scope in 6.4.6 [basic.scope.class] paragraph 1 says,
A name N used in a class S shall refer to the same declaration in its context and when re-evaluated in the completed scope of S. No diagnostic is required for a violation of this rule.
It is not clear that this provision does not apply to names appearing in function bodies, default arguments, exception-specifications, and brace-or-equal-initializers. It is also not clear what it means to “re-evaluate” a name.
One possible approach to this problem would be to say that all names declared in a class are visible throughout the class and simply make it ill-formed to refer to a name that has not been declared yet in the contexts in which that is problematic, such as types and template arguments.
In addition, the fourth point says,
A name declared within a member function hides a declaration of the same name whose scope extends to or past the end of the member function's class.
This rule is unneeded, as it simply restates the normal hiding rule in _N4868_.6.4.1 [basic.scope.declarative] paragraph 1:
The scope of a declaration is the same as its potential scope unless the potential scope contains another declaration of the same name. In that case, the potential scope of the declaration in the inner (contained) declarative region is excluded from the scope of the declaration
|2021-02-24 00:00:00||admin||set||status: accepted -> drwp|
|2020-12-15 00:00:00||admin||set||status: open -> accepted|