From Jason Turner

[over.over]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp3kes8zsi/{from.md → to.md} +40 -37
tmp/tmp3kes8zsi/{from.md → to.md} RENAMED
@@ -1,44 +1,42 @@
1
  ## Address of overloaded function <a id="over.over">[[over.over]]</a>
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]]),
21
- - a parameter of a user-defined operator ([[over.oper]]),
22
- - the return value of a function, operator function, or conversion (
23
- [[stmt.return]]),
24
  - an explicit type conversion ([[expr.type.conv]],
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
@@ -46,23 +44,28 @@ identifies a single function template specialization. If it does, the
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
 
 
57
  specializations in the set are eliminated if the set also contains a
58
- function that is not a function template specialization, and any given
59
- function template specialization `F1` is eliminated if the set contains
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);
 
1
  ## Address of overloaded function <a id="over.over">[[over.over]]</a>
2
 
3
+ A use of a function name without arguments is resolved to a function, a
4
+ pointer to function, or a pointer to member function for a specific
5
+ function that is chosen from a set of selected functions determined
6
+ based on the target type required in the context (if any), as described
7
+ below. The target can be
 
 
 
 
 
 
 
 
8
 
9
  - an object or reference being initialized ([[dcl.init]],
10
  [[dcl.init.ref]], [[dcl.init.list]]),
11
+ - the left side of an assignment [[expr.ass]],
12
+ - a parameter of a function [[expr.call]],
13
+ - a parameter of a user-defined operator [[over.oper]],
14
+ - the return value of a function, operator function, or conversion
15
+ [[stmt.return]],
16
  - an explicit type conversion ([[expr.type.conv]],
17
  [[expr.static.cast]], [[expr.cast]]), or
18
+ - a non-type *template-parameter* [[temp.arg.nontype]].
19
 
20
+ The function name can be preceded by the `&` operator.
 
 
21
 
22
+ [*Note 1*: Any redundant set of parentheses surrounding the function
23
+ name is ignored [[expr.prim.paren]]. — *end note*]
24
 
25
+ If there is no target, all non-template functions named are selected.
26
+ Otherwise, a non-template function with type `F` is selected for the
27
+ function type `FT` of the target type if `F` (after possibly applying
28
+ the function pointer conversion [[conv.fctptr]]) is identical to `FT`.
29
+
30
+ [*Note 2*: That is, the class of which the function is a member is
31
+ ignored when matching a pointer-to-member-function type. — *end note*]
32
+
33
+ For each function template designated by the name, template argument
34
+ deduction is done [[temp.deduct.funcaddr]], and if the argument
35
+ deduction succeeds, the resulting template argument list is used to
36
+ generate a single function template specialization, which is added to
37
+ the set of selected functions considered.
38
 
39
  [*Note 3*: As described in  [[temp.arg.explicit]], if deduction fails
40
  and the function template name is followed by an explicit template
41
  argument list, the *template-id* is then examined to see whether it
42
  identifies a single function template specialization. If it does, the
 
44
  specialization. The target type is not used in that
45
  determination. — *end note*]
46
 
47
  Non-member functions and static member functions match targets of
48
  function pointer type or reference to function type. Non-static member
49
+ functions match targets of pointer-to-member-function type. If a
50
  non-static member function is selected, the reference to the overloaded
51
  function name is required to have the form of a pointer to member as
52
  described in  [[expr.unary.op]].
53
 
54
+ All functions with associated constraints that are not satisfied
55
+ [[temp.constr.decl]] are eliminated from the set of selected functions.
56
+ If more than one function in the set remains, all function template
57
  specializations in the set are eliminated if the set also contains a
58
+ function that is not a function template specialization. Any given
59
+ non-template function `F0` is eliminated if the set contains a second
60
+ non-template function that is more constrained than `F0` according to
61
+ the partial ordering rules of [[temp.constr.order]]. Any given function
62
+ template specialization `F1` is eliminated if the set contains a second
63
+ function template specialization whose function template is more
64
+ specialized than the function template of `F1` according to the partial
65
+ ordering rules of  [[temp.func.order]]. After such eliminations, if any,
66
+ there shall remain exactly one selected function.
67
 
68
  [*Example 1*:
69
 
70
  ``` cpp
71
  int f(double);