tmp/tmp10tyrmoz/{from.md → to.md}
RENAMED
|
@@ -13,72 +13,69 @@ type. For a call to a non-member function or to a static member
|
|
| 13 |
function, the postfix expression shall either be an lvalue that refers
|
| 14 |
to a function (in which case the function-to-pointer standard conversion
|
| 15 |
[[conv.func]] is suppressed on the postfix expression), or have function
|
| 16 |
pointer type.
|
| 17 |
|
| 18 |
-
For a call to a non-static member function, the postfix expression shall
|
| 19 |
-
be an implicit ([[class.mfct.non-static]], [[class.static]]) or
|
| 20 |
-
explicit class member access [[expr.ref]] whose *id-expression* is a
|
| 21 |
-
function member name, or a pointer-to-member expression
|
| 22 |
-
[[expr.mptr.oper]] selecting a function member; the call is as a member
|
| 23 |
-
of the class object referred to by the object expression. In the case of
|
| 24 |
-
an implicit class member access, the implied object is the one pointed
|
| 25 |
-
to by `this`.
|
| 26 |
-
|
| 27 |
-
[*Note 2*: A member function call of the form `f()` is interpreted as
|
| 28 |
-
`(*this).f()` (see [[class.mfct.non-static]]). — *end note*]
|
| 29 |
-
|
| 30 |
If the selected function is non-virtual, or if the *id-expression* in
|
| 31 |
the class member access expression is a *qualified-id*, that function is
|
| 32 |
called. Otherwise, its final overrider [[class.virtual]] in the dynamic
|
| 33 |
type of the object expression is called; such a call is referred to as a
|
| 34 |
*virtual function call*.
|
| 35 |
|
| 36 |
-
[*Note
|
| 37 |
the current value of the object expression. [[class.cdtor]] describes
|
| 38 |
the behavior of virtual function calls when the object expression refers
|
| 39 |
to an object under construction or destruction. — *end note*]
|
| 40 |
|
| 41 |
-
[*Note
|
| 42 |
lookup [[basic.lookup]] does not find a declaration of that name, the
|
| 43 |
program is ill-formed. No function is implicitly declared by such a
|
| 44 |
call. — *end note*]
|
| 45 |
|
| 46 |
If the *postfix-expression* names a destructor or pseudo-destructor
|
| 47 |
[[expr.prim.id.dtor]], the type of the function call expression is
|
| 48 |
`void`; otherwise, the type of the function call expression is the
|
| 49 |
return type of the statically chosen function (i.e., ignoring the
|
| 50 |
`virtual` keyword), even if the type of the function actually called is
|
| 51 |
-
different.
|
| 52 |
-
cv `void`. If the *postfix-expression* names a pseudo-destructor (in
|
| 53 |
which case the *postfix-expression* is a possibly-parenthesized class
|
| 54 |
member access), the function call destroys the object of scalar type
|
| 55 |
-
denoted by the object expression of the class member access
|
| 56 |
-
[[expr.ref]], [[basic.life]]
|
| 57 |
|
| 58 |
-
Calling a function through an expression whose function type is
|
| 59 |
-
different from the function type of the called function’s definition
|
| 60 |
-
results in undefined behavior
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
[*Example 1*:
|
| 68 |
|
| 69 |
``` cpp
|
| 70 |
template<typename ...T> int f(int n = 0, T ...t);
|
| 71 |
int x = f<int>(); // error: no argument for second function parameter
|
| 72 |
```
|
| 73 |
|
| 74 |
— *end example*]
|
| 75 |
|
| 76 |
-
If the function is
|
| 77 |
-
the function [[
|
| 78 |
-
of the call, converted as if by an explicit type
|
| 79 |
-
[[expr.cast]].
|
| 80 |
|
| 81 |
[*Note 5*: There is no access or ambiguity checking on this conversion;
|
| 82 |
the access checking and disambiguation are done as part of the (possibly
|
| 83 |
implicit) class member access operator. See [[class.member.lookup]],
|
| 84 |
[[class.access.base]], and [[expr.ref]]. — *end note*]
|
|
@@ -96,14 +93,14 @@ enclosing full-expression. The initialization and destruction of each
|
|
| 96 |
parameter occurs within the context of the calling function.
|
| 97 |
|
| 98 |
[*Example 2*: The access of the constructor, conversion functions or
|
| 99 |
destructor is checked at the point of call in the calling function. If a
|
| 100 |
constructor or destructor for a function parameter throws an exception,
|
| 101 |
-
the search for a handler starts in the
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
|
| 106 |
The *postfix-expression* is sequenced before each *expression* in the
|
| 107 |
*expression-list* and any default argument. The initialization of a
|
| 108 |
parameter, including every associated value computation and side effect,
|
| 109 |
is indeterminately sequenced with respect to that of any other
|
|
@@ -159,14 +156,14 @@ statically chosen function.
|
|
| 159 |
parameters, but these changes cannot affect the values of the arguments
|
| 160 |
except where a parameter is of a reference type [[dcl.ref]]; if the
|
| 161 |
reference is to a const-qualified type, `const_cast` is required to be
|
| 162 |
used to cast away the constness in order to modify the argument’s value.
|
| 163 |
Where a parameter is of `const` reference type a temporary object is
|
| 164 |
-
introduced if needed
|
| 165 |
-
[[dcl.
|
| 166 |
-
modify the values of non-constant objects
|
| 167 |
-
parameters. — *end note*]
|
| 168 |
|
| 169 |
A function can be declared to accept fewer arguments (by declaring
|
| 170 |
default arguments [[dcl.fct.default]]) or more arguments (by using the
|
| 171 |
ellipsis, `...`, or a function parameter pack [[dcl.fct]]) than the
|
| 172 |
number of parameters in the function definition [[dcl.fct.def]].
|
|
|
|
| 13 |
function, the postfix expression shall either be an lvalue that refers
|
| 14 |
to a function (in which case the function-to-pointer standard conversion
|
| 15 |
[[conv.func]] is suppressed on the postfix expression), or have function
|
| 16 |
pointer type.
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
If the selected function is non-virtual, or if the *id-expression* in
|
| 19 |
the class member access expression is a *qualified-id*, that function is
|
| 20 |
called. Otherwise, its final overrider [[class.virtual]] in the dynamic
|
| 21 |
type of the object expression is called; such a call is referred to as a
|
| 22 |
*virtual function call*.
|
| 23 |
|
| 24 |
+
[*Note 2*: The dynamic type is the type of the object referred to by
|
| 25 |
the current value of the object expression. [[class.cdtor]] describes
|
| 26 |
the behavior of virtual function calls when the object expression refers
|
| 27 |
to an object under construction or destruction. — *end note*]
|
| 28 |
|
| 29 |
+
[*Note 3*: If a function or member function name is used, and name
|
| 30 |
lookup [[basic.lookup]] does not find a declaration of that name, the
|
| 31 |
program is ill-formed. No function is implicitly declared by such a
|
| 32 |
call. — *end note*]
|
| 33 |
|
| 34 |
If the *postfix-expression* names a destructor or pseudo-destructor
|
| 35 |
[[expr.prim.id.dtor]], the type of the function call expression is
|
| 36 |
`void`; otherwise, the type of the function call expression is the
|
| 37 |
return type of the statically chosen function (i.e., ignoring the
|
| 38 |
`virtual` keyword), even if the type of the function actually called is
|
| 39 |
+
different. If the *postfix-expression* names a pseudo-destructor (in
|
|
|
|
| 40 |
which case the *postfix-expression* is a possibly-parenthesized class
|
| 41 |
member access), the function call destroys the object of scalar type
|
| 42 |
+
denoted by the object expression of the class member access
|
| 43 |
+
[[expr.ref]], [[basic.life]].
|
| 44 |
|
| 45 |
+
Calling a function through an expression whose function type `E` is
|
| 46 |
+
different from the function type `F` of the called function’s definition
|
| 47 |
+
results in undefined behavior unless the type “pointer to `F`” can be
|
| 48 |
+
converted to the type “pointer to `E`” via a function pointer conversion
|
| 49 |
+
[[conv.fctptr]].
|
| 50 |
|
| 51 |
+
[*Note 4*: The exception applies when the expression has the type of a
|
| 52 |
+
potentially-throwing function, but the called function has a
|
| 53 |
+
non-throwing exception specification, and the function types are
|
| 54 |
+
otherwise the same. — *end note*]
|
| 55 |
+
|
| 56 |
+
When a function is called, each parameter [[dcl.fct]] is initialized
|
| 57 |
+
[[dcl.init]], [[class.copy.ctor]] with its corresponding argument. If
|
| 58 |
+
the function is an explicit object member function and there is an
|
| 59 |
+
implied object argument [[over.call.func]], the list of provided
|
| 60 |
+
arguments is preceded by the implied object argument for the purposes of
|
| 61 |
+
this correspondence. If there is no corresponding argument, the default
|
| 62 |
+
argument for the parameter is used.
|
| 63 |
|
| 64 |
[*Example 1*:
|
| 65 |
|
| 66 |
``` cpp
|
| 67 |
template<typename ...T> int f(int n = 0, T ...t);
|
| 68 |
int x = f<int>(); // error: no argument for second function parameter
|
| 69 |
```
|
| 70 |
|
| 71 |
— *end example*]
|
| 72 |
|
| 73 |
+
If the function is an implicit object member function, the `this`
|
| 74 |
+
parameter of the function [[expr.prim.this]] is initialized with a
|
| 75 |
+
pointer to the object of the call, converted as if by an explicit type
|
| 76 |
+
conversion [[expr.cast]].
|
| 77 |
|
| 78 |
[*Note 5*: There is no access or ambiguity checking on this conversion;
|
| 79 |
the access checking and disambiguation are done as part of the (possibly
|
| 80 |
implicit) class member access operator. See [[class.member.lookup]],
|
| 81 |
[[class.access.base]], and [[expr.ref]]. — *end note*]
|
|
|
|
| 93 |
parameter occurs within the context of the calling function.
|
| 94 |
|
| 95 |
[*Example 2*: The access of the constructor, conversion functions or
|
| 96 |
destructor is checked at the point of call in the calling function. If a
|
| 97 |
constructor or destructor for a function parameter throws an exception,
|
| 98 |
+
the search for a handler starts in the calling function; in particular,
|
| 99 |
+
if the function called has a *function-try-block* [[except.pre]] with a
|
| 100 |
+
handler that can handle the exception, this handler is not
|
| 101 |
+
considered. — *end example*]
|
| 102 |
|
| 103 |
The *postfix-expression* is sequenced before each *expression* in the
|
| 104 |
*expression-list* and any default argument. The initialization of a
|
| 105 |
parameter, including every associated value computation and side effect,
|
| 106 |
is indeterminately sequenced with respect to that of any other
|
|
|
|
| 156 |
parameters, but these changes cannot affect the values of the arguments
|
| 157 |
except where a parameter is of a reference type [[dcl.ref]]; if the
|
| 158 |
reference is to a const-qualified type, `const_cast` is required to be
|
| 159 |
used to cast away the constness in order to modify the argument’s value.
|
| 160 |
Where a parameter is of `const` reference type a temporary object is
|
| 161 |
+
introduced if needed
|
| 162 |
+
[[dcl.type]], [[lex.literal]], [[lex.string]], [[dcl.array]], [[class.temporary]].
|
| 163 |
+
In addition, it is possible to modify the values of non-constant objects
|
| 164 |
+
through pointer parameters. — *end note*]
|
| 165 |
|
| 166 |
A function can be declared to accept fewer arguments (by declaring
|
| 167 |
default arguments [[dcl.fct.default]]) or more arguments (by using the
|
| 168 |
ellipsis, `...`, or a function parameter pack [[dcl.fct]]) than the
|
| 169 |
number of parameters in the function definition [[dcl.fct.def]].
|