From Jason Turner

[basic.lookup.classref]

Diff to HTML by rtfpessoa

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