From Jason Turner

[basic.lookup.classref]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpyrxbfvm3/{from.md → to.md} +22 -4
tmp/tmpyrxbfvm3/{from.md → to.md} RENAMED
@@ -17,11 +17,13 @@ looked up in the context of the complete *postfix-expression*.
17
 
18
  If the *unqualified-id* is `~`*type-name*, the *type-name* is looked up
19
  in the context of the entire *postfix-expression*. If the type `T` of
20
  the object expression is of a class type `C`, the *type-name* is also
21
  looked up in the scope of class `C`. At least one of the lookups shall
22
- find a name that refers to (possibly cv-qualified) `T`.
 
 
23
 
24
  ``` cpp
25
  struct A { };
26
 
27
  struct B {
@@ -32,22 +34,34 @@ struct B {
32
  void B::f(::A* a) {
33
  a->~A(); // OK: lookup in *a finds the injected-class-name
34
  }
35
  ```
36
 
 
 
37
  If the *id-expression* in a class member access is a *qualified-id* of
38
  the form
39
 
 
 
 
 
40
  the *class-name-or-namespace-name* following the `.` or `->` operator is
41
  first looked up in the class of the object expression and the name, if
42
  found, is used. Otherwise it is looked up in the context of the entire
43
- *postfix-expression*. See  [[basic.lookup.qual]], which describes the
44
- lookup of a name before `::`, which will only find a type or namespace
45
- name.
 
 
46
 
47
  If the *qualified-id* has the form
48
 
 
 
 
 
49
  the *class-name-or-namespace-name* is looked up in global scope as a
50
  *class-name* or *namespace-name*.
51
 
52
  If the *nested-name-specifier* contains a *simple-template-id* (
53
  [[temp.names]]), the names in its *template-argument*s are looked up in
@@ -58,10 +72,12 @@ If the *id-expression* is a *conversion-function-id*, its
58
  expression and the name, if found, is used. Otherwise it is looked up in
59
  the context of the entire *postfix-expression*. In each of these
60
  lookups, only names that denote types or templates whose specializations
61
  are types are considered.
62
 
 
 
63
  ``` cpp
64
  struct A { };
65
  namespace N {
66
  struct A {
67
  void g() { }
@@ -73,5 +89,7 @@ int main() {
73
  N::A a;
74
  a.operator A(); // calls N::A::operator N::A
75
  }
76
  ```
77
 
 
 
 
17
 
18
  If the *unqualified-id* is `~`*type-name*, the *type-name* is looked up
19
  in the context of the entire *postfix-expression*. If the type `T` of
20
  the object expression is of a class type `C`, the *type-name* is also
21
  looked up in the scope of class `C`. At least one of the lookups shall
22
+ find a name that refers to cv `T`.
23
+
24
+ [*Example 1*:
25
 
26
  ``` cpp
27
  struct A { };
28
 
29
  struct B {
 
34
  void B::f(::A* a) {
35
  a->~A(); // OK: lookup in *a finds the injected-class-name
36
  }
37
  ```
38
 
39
+ — *end example*]
40
+
41
  If the *id-expression* in a class member access is a *qualified-id* of
42
  the form
43
 
44
+ ``` cpp
45
+ class-name-or-namespace-name::...
46
+ ```
47
+
48
  the *class-name-or-namespace-name* following the `.` or `->` operator is
49
  first looked up in the class of the object expression and the name, if
50
  found, is used. Otherwise it is looked up in the context of the entire
51
+ *postfix-expression*.
52
+
53
+ [*Note 1*: See  [[basic.lookup.qual]], which describes the lookup of a
54
+ name before `::`, which will only find a type or namespace
55
+ name. — *end note*]
56
 
57
  If the *qualified-id* has the form
58
 
59
+ ``` cpp
60
+ ::class-name-or-namespace-name::...
61
+ ```
62
+
63
  the *class-name-or-namespace-name* is looked up in global scope as a
64
  *class-name* or *namespace-name*.
65
 
66
  If the *nested-name-specifier* contains a *simple-template-id* (
67
  [[temp.names]]), the names in its *template-argument*s are looked up in
 
72
  expression and the name, if found, is used. Otherwise it is looked up in
73
  the context of the entire *postfix-expression*. In each of these
74
  lookups, only names that denote types or templates whose specializations
75
  are types are considered.
76
 
77
+ [*Example 2*:
78
+
79
  ``` cpp
80
  struct A { };
81
  namespace N {
82
  struct A {
83
  void g() { }
 
89
  N::A a;
90
  a.operator A(); // calls N::A::operator N::A
91
  }
92
  ```
93
 
94
+ — *end example*]
95
+