tmp/tmp_nszc5nz/{from.md → to.md}
RENAMED
|
@@ -1,26 +1,28 @@
|
|
| 1 |
## Address of an overload set <a id="over.over">[[over.over]]</a>
|
| 2 |
|
| 3 |
-
An
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
The target can be
|
| 9 |
|
| 10 |
- an object or reference being initialized
|
| 11 |
[[dcl.init]], [[dcl.init.ref]], [[dcl.init.list]],
|
| 12 |
-
- the left side of an assignment [[expr.
|
| 13 |
- a parameter of a function [[expr.call]],
|
| 14 |
- a parameter of a user-defined operator [[over.oper]],
|
| 15 |
- the return value of a function, operator function, or conversion
|
| 16 |
[[stmt.return]],
|
| 17 |
- an explicit type conversion
|
| 18 |
[[expr.type.conv]], [[expr.static.cast]], [[expr.cast]], or
|
| 19 |
-
- a
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
[*Note 1*: Any redundant set of parentheses surrounding the function
|
| 24 |
name is ignored [[expr.prim.paren]]. — *end note*]
|
| 25 |
|
| 26 |
If there is no target, all non-template functions named are selected.
|
|
@@ -49,17 +51,17 @@ All functions with associated constraints that are not satisfied
|
|
| 49 |
[[temp.constr.decl]] are eliminated from the set of selected functions.
|
| 50 |
If more than one function in the set remains, all function template
|
| 51 |
specializations in the set are eliminated if the set also contains a
|
| 52 |
function that is not a function template specialization. Any given
|
| 53 |
non-template function `F0` is eliminated if the set contains a second
|
| 54 |
-
non-template function that is more constrained than
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
|
| 62 |
[*Example 1*:
|
| 63 |
|
| 64 |
``` cpp
|
| 65 |
int f(double);
|
|
@@ -73,12 +75,15 @@ void g() {
|
|
| 73 |
(int (*)(int))&f; // cast expression as selector
|
| 74 |
}
|
| 75 |
```
|
| 76 |
|
| 77 |
The initialization of `pfe` is ill-formed because no `f()` with type
|
| 78 |
-
`int(...)` has been declared, and not because of any ambiguity.
|
| 79 |
-
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
``` cpp
|
| 82 |
struct X {
|
| 83 |
int f(int);
|
| 84 |
static int f(long);
|
|
@@ -93,10 +98,27 @@ int (X::*p5)(int) = &(X::f); // error: wrong syntax for
|
|
| 93 |
int (*p6)(long) = &(X::f); // OK
|
| 94 |
```
|
| 95 |
|
| 96 |
— *end example*]
|
| 97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
[*Note 4*: If `f` and `g` are both overload sets, the Cartesian product
|
| 99 |
of possibilities is considered to resolve `f(&g)`, or the equivalent
|
| 100 |
expression `f(g)`. — *end note*]
|
| 101 |
|
| 102 |
[*Note 5*:
|
|
|
|
| 1 |
## Address of an overload set <a id="over.over">[[over.over]]</a>
|
| 2 |
|
| 3 |
+
An expression that designates an overload set S and that appears without
|
| 4 |
+
arguments is resolved to a function, a pointer to function, or a pointer
|
| 5 |
+
to member function for a specific function that is chosen from a set of
|
| 6 |
+
functions selected from S determined based on the target type required
|
| 7 |
+
in the context (if any), as described below. The target can be
|
|
|
|
| 8 |
|
| 9 |
- an object or reference being initialized
|
| 10 |
[[dcl.init]], [[dcl.init.ref]], [[dcl.init.list]],
|
| 11 |
+
- the left side of an assignment [[expr.assign]],
|
| 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
|
| 17 |
[[expr.type.conv]], [[expr.static.cast]], [[expr.cast]], or
|
| 18 |
+
- a constant template parameter [[temp.arg.nontype]].
|
| 19 |
|
| 20 |
+
If the target type contains a placeholder type, placeholder type
|
| 21 |
+
deduction is performed [[dcl.type.auto.deduct]], and the remainder of
|
| 22 |
+
this subclause uses the target type so deduced. The expression can be
|
| 23 |
+
preceded by the `&` operator.
|
| 24 |
|
| 25 |
[*Note 1*: Any redundant set of parentheses surrounding the function
|
| 26 |
name is ignored [[expr.prim.paren]]. — *end note*]
|
| 27 |
|
| 28 |
If there is no target, all non-template functions named are selected.
|
|
|
|
| 51 |
[[temp.constr.decl]] are eliminated from the set of selected functions.
|
| 52 |
If more than one function in the set remains, all function template
|
| 53 |
specializations in the set are eliminated if the set also contains a
|
| 54 |
function that is not a function template specialization. Any given
|
| 55 |
non-template function `F0` is eliminated if the set contains a second
|
| 56 |
+
non-template function that is more partial-ordering-constrained than
|
| 57 |
+
`F0` [[temp.constr.order]]. Any given function template specialization
|
| 58 |
+
`F1` is eliminated if the set contains a second function template
|
| 59 |
+
specialization whose function template is more specialized than the
|
| 60 |
+
function template of `F1` according to the partial ordering rules of
|
| 61 |
+
[[temp.func.order]]. After such eliminations, if any, there shall remain
|
| 62 |
+
exactly one selected function.
|
| 63 |
|
| 64 |
[*Example 1*:
|
| 65 |
|
| 66 |
``` cpp
|
| 67 |
int f(double);
|
|
|
|
| 75 |
(int (*)(int))&f; // cast expression as selector
|
| 76 |
}
|
| 77 |
```
|
| 78 |
|
| 79 |
The initialization of `pfe` is ill-formed because no `f()` with type
|
| 80 |
+
`int(...)` has been declared, and not because of any ambiguity.
|
| 81 |
+
|
| 82 |
+
— *end example*]
|
| 83 |
+
|
| 84 |
+
[*Example 2*:
|
| 85 |
|
| 86 |
``` cpp
|
| 87 |
struct X {
|
| 88 |
int f(int);
|
| 89 |
static int f(long);
|
|
|
|
| 98 |
int (*p6)(long) = &(X::f); // OK
|
| 99 |
```
|
| 100 |
|
| 101 |
— *end example*]
|
| 102 |
|
| 103 |
+
[*Example 3*:
|
| 104 |
+
|
| 105 |
+
``` cpp
|
| 106 |
+
template<bool B> struct X {
|
| 107 |
+
void f(short) requires B;
|
| 108 |
+
void f(long);
|
| 109 |
+
template<typename> void g(short) requires B;
|
| 110 |
+
template<typename> void g(long);
|
| 111 |
+
};
|
| 112 |
+
void test() {
|
| 113 |
+
&X<true>::f; // error: ambiguous; constraints are not considered
|
| 114 |
+
&X<true>::g<int>; // error: ambiguous; constraints are not considered
|
| 115 |
+
}
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
— *end example*]
|
| 119 |
+
|
| 120 |
[*Note 4*: If `f` and `g` are both overload sets, the Cartesian product
|
| 121 |
of possibilities is considered to resolve `f(&g)`, or the equivalent
|
| 122 |
expression `f(g)`. — *end note*]
|
| 123 |
|
| 124 |
[*Note 5*:
|