From Jason Turner

[class.qual]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpleogtkl0/{from.md → to.md} +26 -17
tmp/tmpleogtkl0/{from.md → to.md} RENAMED
@@ -2,16 +2,19 @@
2
 
3
  If the *nested-name-specifier* of a *qualified-id* nominates a class,
4
  the name specified after the *nested-name-specifier* is looked up in the
5
  scope of the class ([[class.member.lookup]]), except for the cases
6
  listed below. The name shall represent one or more members of that class
7
- or of one of its base classes (Clause  [[class.derived]]). A class
8
- member can be referred to using a *qualified-id* at any point in its
9
- potential scope ([[basic.scope.class]]). The exceptions to the name
10
- lookup rule above are the following:
11
 
12
- - a destructor name is looked up as specified in  [[basic.lookup.qual]];
 
 
 
 
 
 
13
  - a *conversion-type-id* of a *conversion-function-id* is looked up in
14
  the same manner as a *conversion-type-id* in a class member access
15
  (see  [[basic.lookup.classref]]);
16
  - the names in a *template-argument* of a *template-id* are looked up in
17
  the context in which the entire *postfix-expression* occurs.
@@ -22,22 +25,26 @@ lookup rule above are the following:
22
  In a lookup in which function names are not ignored[^9] and the
23
  *nested-name-specifier* nominates a class `C`:
24
 
25
  - if the name specified after the *nested-name-specifier*, when looked
26
  up in `C`, is the injected-class-name of `C` (Clause  [[class]]), or
27
- - in a *using-declaration* ([[namespace.udecl]]) that is a
28
- *member-declaration*, if the name specified after the
29
- *nested-name-specifier* is the same as the *identifier* or the
30
- *simple-template-id*’s *template-name* in the last component of the
31
- *nested-name-specifier*,
32
-
33
- the name is instead considered to name the constructor of class `C`. For
34
- example, the constructor is not an acceptable lookup result in an
35
- *elaborated-type-specifier* so the constructor would not be used in
36
- place of the injected-class-name. Such a constructor name shall be used
37
- only in the *declarator-id* of a declaration that names a constructor or
38
- in a *using-declaration*.
 
 
 
 
39
 
40
  ``` cpp
41
  struct A { A(); };
42
  struct B: public A { B(); };
43
 
@@ -47,9 +54,11 @@ B::B() { }
47
  B::A ba; // object of type A
48
  A::A a; // error, A::A is not a type name
49
  struct A::A a2; // object of type A
50
  ```
51
 
 
 
52
  A class member name hidden by a name in a nested declarative region or
53
  by the name of a derived class member can still be found if qualified by
54
  the name of its class followed by the `::` operator.
55
 
 
2
 
3
  If the *nested-name-specifier* of a *qualified-id* nominates a class,
4
  the name specified after the *nested-name-specifier* is looked up in the
5
  scope of the class ([[class.member.lookup]]), except for the cases
6
  listed below. The name shall represent one or more members of that class
7
+ or of one of its base classes (Clause  [[class.derived]]).
 
 
 
8
 
9
+ [*Note 1*: A class member can be referred to using a *qualified-id* at
10
+ any point in its potential scope (
11
+ [[basic.scope.class]]). — *end note*]
12
+
13
+ The exceptions to the name lookup rule above are the following:
14
+
15
+ - the lookup for a destructor is as specified in  [[basic.lookup.qual]];
16
  - a *conversion-type-id* of a *conversion-function-id* is looked up in
17
  the same manner as a *conversion-type-id* in a class member access
18
  (see  [[basic.lookup.classref]]);
19
  - the names in a *template-argument* of a *template-id* are looked up in
20
  the context in which the entire *postfix-expression* occurs.
 
25
  In a lookup in which function names are not ignored[^9] and the
26
  *nested-name-specifier* nominates a class `C`:
27
 
28
  - if the name specified after the *nested-name-specifier*, when looked
29
  up in `C`, is the injected-class-name of `C` (Clause  [[class]]), or
30
+ - in a *using-declarator* of a *using-declaration* (
31
+ [[namespace.udecl]]) that is a *member-declaration*, if the name
32
+ specified after the *nested-name-specifier* is the same as the
33
+ *identifier* or the *simple-template-id*’s *template-name* in the last
34
+ component of the *nested-name-specifier*,
35
+
36
+ the name is instead considered to name the constructor of class `C`.
37
+
38
+ [*Note 2*: For example, the constructor is not an acceptable lookup
39
+ result in an *elaborated-type-specifier* so the constructor would not be
40
+ used in place of the injected-class-name. *end note*]
41
+
42
+ Such a constructor name shall be used only in the *declarator-id* of a
43
+ declaration that names a constructor or in a *using-declaration*.
44
+
45
+ [*Example 1*:
46
 
47
  ``` cpp
48
  struct A { A(); };
49
  struct B: public A { B(); };
50
 
 
54
  B::A ba; // object of type A
55
  A::A a; // error, A::A is not a type name
56
  struct A::A a2; // object of type A
57
  ```
58
 
59
+ — *end example*]
60
+
61
  A class member name hidden by a name in a nested declarative region or
62
  by the name of a derived class member can still be found if qualified by
63
  the name of its class followed by the `::` operator.
64