From Jason Turner

[over.over]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpdwa8feog/{from.md → to.md} +37 -22
tmp/tmpdwa8feog/{from.md → to.md} RENAMED
@@ -2,14 +2,19 @@
2
 
3
  A use of an overloaded function name without arguments is resolved in
4
  certain contexts to a function, a pointer to function or a pointer to
5
  member function for a specific function from the overload set. A
6
  function template name is considered to name a set of overloaded
7
- functions in such contexts. The function selected is the one whose type
8
- is identical to the function type of the target type required in the
9
- context. That is, the class of which the function is a member is ignored
10
- when matching a pointer-to-member-function type. The target can be
 
 
 
 
 
11
 
12
  - an object or reference being initialized ([[dcl.init]],
13
  [[dcl.init.ref]], [[dcl.init.list]]),
14
  - the left side of an assignment ([[expr.ass]]),
15
  - a parameter of a function ([[expr.call]]),
@@ -20,28 +25,32 @@ when matching a pointer-to-member-function type. The target can be
20
  [[expr.static.cast]], [[expr.cast]]), or
21
  - a non-type *template-parameter* ([[temp.arg.nontype]]).
22
 
23
  The overloaded function name can be preceded by the `&` operator. An
24
  overloaded function name shall not be used without arguments in contexts
25
- other than those listed. Any redundant set of parentheses surrounding
26
- the overloaded function name is ignored ([[expr.prim]]).
 
 
27
 
28
  If the name is a function template, template argument deduction is
29
  done ([[temp.deduct.funcaddr]]), and if the argument deduction
30
  succeeds, the resulting template argument list is used to generate a
31
  single function template specialization, which is added to the set of
32
- overloaded functions considered. As described in  [[temp.arg.explicit]],
33
- if deduction fails and the function template name is followed by an
34
- explicit template argument list, the *template-id* is then examined to
35
- see whether it identifies a single function template specialization. If
36
- it does, the *template-id* is considered to be an lvalue for that
37
- function template specialization. The target type is not used in that
38
- determination.
39
 
40
- Non-member functions and static member functions match targets of type
41
- “pointer-to-function” or “reference-to-function.” Nonstatic member
42
- functions match targets of type “pointer-to-member-function”. If a
 
 
 
 
 
 
 
 
43
  non-static member function is selected, the reference to the overloaded
44
  function name is required to have the form of a pointer to member as
45
  described in  [[expr.unary.op]].
46
 
47
  If more than one function is selected, any function template
@@ -51,10 +60,12 @@ function template specialization `F1` is eliminated if the set contains
51
  a second function template specialization whose function template is
52
  more specialized than the function template of `F1` according to the
53
  partial ordering rules of  [[temp.func.order]]. After such eliminations,
54
  if any, there shall remain exactly one selected function.
55
 
 
 
56
  ``` cpp
57
  int f(double);
58
  int f(int);
59
  int (*pfd)(double) = &f; // selects f(double)
60
  int (*pfi)(int) = &f; // selects f(int)
@@ -83,21 +94,25 @@ int (X::*p4)(long) = &X::f; // error: mismatch
83
  int (X::*p5)(int) = &(X::f); // error: wrong syntax for
84
  // pointer to member
85
  int (*p6)(long) = &(X::f); // OK
86
  ```
87
 
88
- If `f()` and `g()` are both overloaded functions, the cross product of
89
- possibilities must be considered to resolve `f(&g)`, or the equivalent
90
- expression `f(g)`.
91
 
92
- There are no standard conversions (Clause  [[conv]]) of one
93
- pointer-to-function type into another. In particular, even if `B` is a
94
- public base of `D`, we have
 
 
 
 
95
 
96
  ``` cpp
97
  D* f();
98
  B* (*p1)() = &f; // error
99
 
100
  void g(D*);
101
  void (*p2)(B*) = &g; // error
102
  ```
103
 
 
 
 
2
 
3
  A use of an overloaded function name without arguments is resolved in
4
  certain contexts to a function, a pointer to function or a pointer to
5
  member function for a specific function from the overload set. A
6
  function template name is considered to name a set of overloaded
7
+ functions in such contexts. A function with type `F` is selected for the
8
+ function type `FT` of the target type required in the context if `F`
9
+ (after possibly applying the function pointer conversion (
10
+ [[conv.fctptr]])) is identical to `FT`.
11
+
12
+ [*Note 1*: That is, the class of which the function is a member is
13
+ ignored when matching a pointer-to-member-function type. — *end note*]
14
+
15
+ The target can be
16
 
17
  - an object or reference being initialized ([[dcl.init]],
18
  [[dcl.init.ref]], [[dcl.init.list]]),
19
  - the left side of an assignment ([[expr.ass]]),
20
  - a parameter of a function ([[expr.call]]),
 
25
  [[expr.static.cast]], [[expr.cast]]), or
26
  - a non-type *template-parameter* ([[temp.arg.nontype]]).
27
 
28
  The overloaded function name can be preceded by the `&` operator. An
29
  overloaded function name shall not be used without arguments in contexts
30
+ other than those listed.
31
+
32
+ [*Note 2*: Any redundant set of parentheses surrounding the overloaded
33
+ function name is ignored ([[expr.prim]]). — *end note*]
34
 
35
  If the name is a function template, template argument deduction is
36
  done ([[temp.deduct.funcaddr]]), and if the argument deduction
37
  succeeds, the resulting template argument list is used to generate a
38
  single function template specialization, which is added to the set of
39
+ overloaded functions considered.
 
 
 
 
 
 
40
 
41
+ [*Note 3*: As described in  [[temp.arg.explicit]], if deduction fails
42
+ and the function template name is followed by an explicit template
43
+ argument list, the *template-id* is then examined to see whether it
44
+ identifies a single function template specialization. If it does, the
45
+ *template-id* is considered to be an lvalue for that function template
46
+ specialization. The target type is not used in that
47
+ determination. — *end note*]
48
+
49
+ Non-member functions and static member functions match targets of
50
+ function pointer type or reference to function type. Non-static member
51
+ functions match targets of pointer to member function type. If a
52
  non-static member function is selected, the reference to the overloaded
53
  function name is required to have the form of a pointer to member as
54
  described in  [[expr.unary.op]].
55
 
56
  If more than one function is selected, any function template
 
60
  a second function template specialization whose function template is
61
  more specialized than the function template of `F1` according to the
62
  partial ordering rules of  [[temp.func.order]]. After such eliminations,
63
  if any, there shall remain exactly one selected function.
64
 
65
+ [*Example 1*:
66
+
67
  ``` cpp
68
  int f(double);
69
  int f(int);
70
  int (*pfd)(double) = &f; // selects f(double)
71
  int (*pfi)(int) = &f; // selects f(int)
 
94
  int (X::*p5)(int) = &(X::f); // error: wrong syntax for
95
  // pointer to member
96
  int (*p6)(long) = &(X::f); // OK
97
  ```
98
 
99
+ *end example*]
 
 
100
 
101
+ [*Note 4*: If `f()` and `g()` are both overloaded functions, the cross
102
+ product of possibilities must be considered to resolve `f(&g)`, or the
103
+ equivalent expression `f(g)`. *end note*]
104
+
105
+ [*Note 5*:
106
+
107
+ Even if `B` is a public base of `D`, we have
108
 
109
  ``` cpp
110
  D* f();
111
  B* (*p1)() = &f; // error
112
 
113
  void g(D*);
114
  void (*p2)(B*) = &g; // error
115
  ```
116
 
117
+ — *end note*]
118
+