tmp/tmpkgs5k9ef/{from.md → to.md}
RENAMED
|
@@ -1,29 +1,28 @@
|
|
| 1 |
### Class scope <a id="basic.scope.class">[[basic.scope.class]]</a>
|
| 2 |
|
| 3 |
The potential scope of a name declared in a class consists not only of
|
| 4 |
the declarative region following the name’s point of declaration, but
|
| 5 |
-
also of all
|
| 6 |
-
and *brace-or-equal-initializer*s of non-static data members in that
|
| 7 |
-
class (including such things in nested classes).
|
| 8 |
|
| 9 |
A name `N` used in a class `S` shall refer to the same declaration in
|
| 10 |
its context and when re-evaluated in the completed scope of `S`. No
|
| 11 |
diagnostic is required for a violation of this rule.
|
| 12 |
|
| 13 |
A name declared within a member function hides a declaration of the same
|
| 14 |
name whose scope extends to or past the end of the member function’s
|
| 15 |
class.
|
| 16 |
|
| 17 |
-
The potential scope of a declaration that extends to or past
|
| 18 |
-
a class definition also extends to the regions defined by its
|
| 19 |
-
definitions, even if the members are defined lexically outside
|
| 20 |
-
(this includes static data member definitions, nested class
|
| 21 |
-
and member function definitions, including the member
|
| 22 |
-
any portion of the declarator part of such definitions
|
| 23 |
-
*declarator-id*, including a
|
| 24 |
-
default arguments
|
|
|
|
| 25 |
|
| 26 |
[*Example 1*:
|
| 27 |
|
| 28 |
``` cpp
|
| 29 |
typedef int c;
|
|
@@ -52,13 +51,13 @@ class D {
|
|
| 52 |
— *end example*]
|
| 53 |
|
| 54 |
The name of a class member shall only be used as follows:
|
| 55 |
|
| 56 |
- in the scope of its class (as described above) or a class derived
|
| 57 |
-
|
| 58 |
- after the `.` operator applied to an expression of the type of its
|
| 59 |
-
class
|
| 60 |
-
- after the `->` operator applied to a pointer to an object of its
|
| 61 |
-
|
| 62 |
-
- after the `::` scope resolution operator
|
| 63 |
-
the name of its class or a class derived from its class.
|
| 64 |
|
|
|
|
| 1 |
### Class scope <a id="basic.scope.class">[[basic.scope.class]]</a>
|
| 2 |
|
| 3 |
The potential scope of a name declared in a class consists not only of
|
| 4 |
the declarative region following the name’s point of declaration, but
|
| 5 |
+
also of all complete-class contexts [[class.mem]] of that class.
|
|
|
|
|
|
|
| 6 |
|
| 7 |
A name `N` used in a class `S` shall refer to the same declaration in
|
| 8 |
its context and when re-evaluated in the completed scope of `S`. No
|
| 9 |
diagnostic is required for a violation of this rule.
|
| 10 |
|
| 11 |
A name declared within a member function hides a declaration of the same
|
| 12 |
name whose scope extends to or past the end of the member function’s
|
| 13 |
class.
|
| 14 |
|
| 15 |
+
The potential scope of a declaration in a class that extends to or past
|
| 16 |
+
the end of a class definition also extends to the regions defined by its
|
| 17 |
+
member definitions, even if the members are defined lexically outside
|
| 18 |
+
the class (this includes static data member definitions, nested class
|
| 19 |
+
definitions, and member function definitions, including the member
|
| 20 |
+
function body and any portion of the declarator part of such definitions
|
| 21 |
+
which follows the *declarator-id*, including a
|
| 22 |
+
*parameter-declaration-clause* and any default arguments
|
| 23 |
+
[[dcl.fct.default]]).
|
| 24 |
|
| 25 |
[*Example 1*:
|
| 26 |
|
| 27 |
``` cpp
|
| 28 |
typedef int c;
|
|
|
|
| 51 |
— *end example*]
|
| 52 |
|
| 53 |
The name of a class member shall only be used as follows:
|
| 54 |
|
| 55 |
- in the scope of its class (as described above) or a class derived
|
| 56 |
+
[[class.derived]] from its class,
|
| 57 |
- after the `.` operator applied to an expression of the type of its
|
| 58 |
+
class [[expr.ref]] or a class derived from its class,
|
| 59 |
+
- after the `->` operator applied to a pointer to an object of its class
|
| 60 |
+
[[expr.ref]] or a class derived from its class,
|
| 61 |
+
- after the `::` scope resolution operator [[expr.prim.id.qual]] applied
|
| 62 |
+
to the name of its class or a class derived from its class.
|
| 63 |
|