tmp/tmpiwjw04j0/{from.md → to.md}
RENAMED
|
@@ -1,23 +1,23 @@
|
|
| 1 |
#### Function call syntax <a id="over.match.call">[[over.match.call]]</a>
|
| 2 |
|
| 3 |
-
In a function call
|
| 4 |
|
| 5 |
``` bnf
|
| 6 |
postfix-expression '(' expression-listₒₚₜ ')'
|
| 7 |
```
|
| 8 |
|
| 9 |
-
if the *postfix-expression*
|
| 10 |
-
|
| 11 |
[[over.call.func]]. If the *postfix-expression* denotes an object of
|
| 12 |
class type, overload resolution is applied as specified in
|
| 13 |
[[over.call.object]].
|
| 14 |
|
| 15 |
-
If the *postfix-expression*
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
|
| 20 |
[*Note 1*: The resolution of the address of an overload set in other
|
| 21 |
contexts is described in [[over.over]]. — *end note*]
|
| 22 |
|
| 23 |
##### Call to named function <a id="over.call.func">[[over.call.func]]</a>
|
|
@@ -39,82 +39,75 @@ These represent two syntactic subcategories of function calls: qualified
|
|
| 39 |
function calls and unqualified function calls.
|
| 40 |
|
| 41 |
In qualified function calls, the name to be resolved is an
|
| 42 |
*id-expression* and is preceded by an `->` or `.` operator. Since the
|
| 43 |
construct `A->B` is generally equivalent to `(*A).B`, the rest of
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
|
| 57 |
In unqualified function calls, the name is not qualified by an `->` or
|
| 58 |
`.` operator and has the more general form of a *primary-expression*.
|
| 59 |
The name is looked up in the context of the function call following the
|
| 60 |
-
normal rules for name lookup in
|
| 61 |
function declarations found by that lookup constitute the set of
|
| 62 |
candidate functions. Because of the rules for name lookup, the set of
|
| 63 |
candidate functions consists (1) entirely of non-member functions or (2)
|
| 64 |
entirely of member functions of some class `T`. In case (1), the
|
| 65 |
argument list is the same as the *expression-list* in the call. In case
|
| 66 |
(2), the argument list is the *expression-list* in the call augmented by
|
| 67 |
the addition of an implied object argument as in a qualified function
|
| 68 |
-
call. If the keyword `this`
|
| 69 |
class `T`, or a derived class of `T`, then the implied object argument
|
| 70 |
is `(*this)`. If the keyword `this` is not in scope or refers to another
|
| 71 |
class, then a contrived object of type `T` becomes the implied object
|
| 72 |
-
argument[^4]
|
| 73 |
and overload resolution selects one of the non-static member functions
|
| 74 |
of `T`, the call is ill-formed.
|
| 75 |
|
| 76 |
##### Call to object of class type <a id="over.call.object">[[over.call.object]]</a>
|
| 77 |
|
| 78 |
-
If the *
|
| 79 |
a class object of type “cv `T`”, then the set of candidate functions
|
| 80 |
includes at least the function call operators of `T`. The function call
|
| 81 |
operators of `T` are obtained by ordinary lookup of the name
|
| 82 |
`operator()` in the context of `(E).operator()`.
|
| 83 |
|
| 84 |
In addition, for each non-explicit conversion function declared in `T`
|
| 85 |
of the form
|
| 86 |
|
| 87 |
``` bnf
|
| 88 |
-
|
| 89 |
```
|
| 90 |
|
| 91 |
-
where *cv-qualifier* is the same cv-qualification as,
|
| 92 |
-
cv-qualification than, cv, and where *conversion-type-id*
|
| 93 |
-
type “pointer to function of (`P₁`, …, `Pₙ`) returning `R`”,
|
| 94 |
-
“reference to pointer to function of (`P₁`, …, `Pₙ`)
|
| 95 |
-
the type “reference to function of (`P₁`, …, `Pₙ`)
|
| 96 |
-
*surrogate call function* with the unique name
|
| 97 |
-
having the form
|
| 98 |
|
| 99 |
``` bnf
|
| 100 |
-
'R' call-function '(' conversion-type-id \ %
|
| 101 |
'F, P₁ a₁, …, Pₙ aₙ)' '{ return F (a₁, …, aₙ); }'
|
| 102 |
```
|
| 103 |
|
| 104 |
is also considered as a candidate function. Similarly, surrogate call
|
| 105 |
functions are added to the set of candidate functions for each
|
| 106 |
non-explicit conversion function declared in a base class of `T`
|
| 107 |
provided the function is not hidden within `T` by another intervening
|
| 108 |
-
declaration[^5]
|
| 109 |
-
|
| 110 |
-
If such a surrogate call function is selected by overload resolution,
|
| 111 |
-
the corresponding conversion function will be called to convert `E` to
|
| 112 |
-
the appropriate function pointer or reference, and the function will
|
| 113 |
-
then be invoked with the arguments of the call. If the conversion
|
| 114 |
-
function cannot be called (e.g., because of an ambiguity), the program
|
| 115 |
-
is ill-formed.
|
| 116 |
|
| 117 |
The argument list submitted to overload resolution consists of the
|
| 118 |
argument expressions present in the function call syntax preceded by the
|
| 119 |
implied object argument `(E)`.
|
| 120 |
|
|
|
|
| 1 |
#### Function call syntax <a id="over.match.call">[[over.match.call]]</a>
|
| 2 |
|
| 3 |
+
In a function call [[expr.call]]
|
| 4 |
|
| 5 |
``` bnf
|
| 6 |
postfix-expression '(' expression-listₒₚₜ ')'
|
| 7 |
```
|
| 8 |
|
| 9 |
+
if the *postfix-expression* names at least one function or function
|
| 10 |
+
template, overload resolution is applied as specified in
|
| 11 |
[[over.call.func]]. If the *postfix-expression* denotes an object of
|
| 12 |
class type, overload resolution is applied as specified in
|
| 13 |
[[over.call.object]].
|
| 14 |
|
| 15 |
+
If the *postfix-expression* is the address of an overload set, overload
|
| 16 |
+
resolution is applied using that set as described above. If the function
|
| 17 |
+
selected by overload resolution is a non-static member function, the
|
| 18 |
+
program is ill-formed.
|
| 19 |
|
| 20 |
[*Note 1*: The resolution of the address of an overload set in other
|
| 21 |
contexts is described in [[over.over]]. — *end note*]
|
| 22 |
|
| 23 |
##### Call to named function <a id="over.call.func">[[over.call.func]]</a>
|
|
|
|
| 39 |
function calls and unqualified function calls.
|
| 40 |
|
| 41 |
In qualified function calls, the name to be resolved is an
|
| 42 |
*id-expression* and is preceded by an `->` or `.` operator. Since the
|
| 43 |
construct `A->B` is generally equivalent to `(*A).B`, the rest of
|
| 44 |
+
[[over]] assumes, without loss of generality, that all member function
|
| 45 |
+
calls have been normalized to the form that uses an object and the `.`
|
| 46 |
+
operator. Furthermore, [[over]] assumes that the *postfix-expression*
|
| 47 |
+
that is the left operand of the `.` operator has type “cv `T`” where `T`
|
| 48 |
+
denotes a class.[^3] Under this assumption, the *id-expression* in the
|
| 49 |
+
call is looked up as a member function of `T` following the rules for
|
| 50 |
+
looking up names in classes [[class.member.lookup]]. The function
|
| 51 |
+
declarations found by that lookup constitute the set of candidate
|
| 52 |
+
functions. The argument list is the *expression-list* in the call
|
| 53 |
+
augmented by the addition of the left operand of the `.` operator in the
|
| 54 |
+
normalized member function call as the implied object argument
|
| 55 |
+
[[over.match.funcs]].
|
| 56 |
|
| 57 |
In unqualified function calls, the name is not qualified by an `->` or
|
| 58 |
`.` operator and has the more general form of a *primary-expression*.
|
| 59 |
The name is looked up in the context of the function call following the
|
| 60 |
+
normal rules for name lookup in expressions [[basic.lookup]]. The
|
| 61 |
function declarations found by that lookup constitute the set of
|
| 62 |
candidate functions. Because of the rules for name lookup, the set of
|
| 63 |
candidate functions consists (1) entirely of non-member functions or (2)
|
| 64 |
entirely of member functions of some class `T`. In case (1), the
|
| 65 |
argument list is the same as the *expression-list* in the call. In case
|
| 66 |
(2), the argument list is the *expression-list* in the call augmented by
|
| 67 |
the addition of an implied object argument as in a qualified function
|
| 68 |
+
call. If the keyword `this` [[class.this]] is in scope and refers to
|
| 69 |
class `T`, or a derived class of `T`, then the implied object argument
|
| 70 |
is `(*this)`. If the keyword `this` is not in scope or refers to another
|
| 71 |
class, then a contrived object of type `T` becomes the implied object
|
| 72 |
+
argument.[^4] If the argument list is augmented by a contrived object
|
| 73 |
and overload resolution selects one of the non-static member functions
|
| 74 |
of `T`, the call is ill-formed.
|
| 75 |
|
| 76 |
##### Call to object of class type <a id="over.call.object">[[over.call.object]]</a>
|
| 77 |
|
| 78 |
+
If the *postfix-expression* `E` in the function call syntax evaluates to
|
| 79 |
a class object of type “cv `T`”, then the set of candidate functions
|
| 80 |
includes at least the function call operators of `T`. The function call
|
| 81 |
operators of `T` are obtained by ordinary lookup of the name
|
| 82 |
`operator()` in the context of `(E).operator()`.
|
| 83 |
|
| 84 |
In addition, for each non-explicit conversion function declared in `T`
|
| 85 |
of the form
|
| 86 |
|
| 87 |
``` bnf
|
| 88 |
+
operator conversion-type-id '( )' cv-qualifier-seqₒₚₜ ref-qualifierₒₚₜ noexcept-specifierₒₚₜ attribute-specifier-seqₒₚₜ ';'
|
| 89 |
```
|
| 90 |
|
| 91 |
+
where the optional *cv-qualifier-seq* is the same cv-qualification as,
|
| 92 |
+
or a greater cv-qualification than, cv, and where *conversion-type-id*
|
| 93 |
+
denotes the type “pointer to function of (`P₁`, …, `Pₙ`) returning `R`”,
|
| 94 |
+
or the type “reference to pointer to function of (`P₁`, …, `Pₙ`)
|
| 95 |
+
returning `R`”, or the type “reference to function of (`P₁`, …, `Pₙ`)
|
| 96 |
+
returning `R`”, a *surrogate call function* with the unique name
|
| 97 |
+
*call-function* and having the form
|
| 98 |
|
| 99 |
``` bnf
|
| 100 |
+
'R' *call-function* '(' conversion-type-id \ %
|
| 101 |
'F, P₁ a₁, …, Pₙ aₙ)' '{ return F (a₁, …, aₙ); }'
|
| 102 |
```
|
| 103 |
|
| 104 |
is also considered as a candidate function. Similarly, surrogate call
|
| 105 |
functions are added to the set of candidate functions for each
|
| 106 |
non-explicit conversion function declared in a base class of `T`
|
| 107 |
provided the function is not hidden within `T` by another intervening
|
| 108 |
+
declaration.[^5]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
|
| 110 |
The argument list submitted to overload resolution consists of the
|
| 111 |
argument expressions present in the function call syntax preceded by the
|
| 112 |
implied object argument `(E)`.
|
| 113 |
|