|
3066 | 3066 | \end{codeblock}
|
3067 | 3067 | \end{example}
|
3068 | 3068 | If the function is a non-static member
|
3069 |
| -function, the \tcode{this} parameter of the function\iref{class.this} |
| 3069 | +function, the \tcode{this} parameter of the function\iref{expr.prim.this} |
3070 | 3070 | is initialized with a pointer to the object of the call, converted
|
3071 | 3071 | as if by an explicit type conversion\iref{expr.cast}.
|
3072 | 3072 | \begin{note}
|
|
3093 | 3093 | The access of the constructor, conversion functions or destructor is
|
3094 | 3094 | checked at the point of call in the calling function. If a constructor
|
3095 | 3095 | or destructor for a function parameter throws an exception, the search
|
3096 |
| -for a handler starts in the scope of the calling function; in |
| 3096 | +for a handler starts in the calling function; in |
3097 | 3097 | particular, if the function called has a \grammarterm{function-try-block}\iref{except.pre}
|
3098 | 3098 | with a handler that could handle the exception,
|
3099 | 3099 | this handler is not considered.
|
|
3287 | 3287 | \indextext{arrow operator|see{operator, class member access}}%
|
3288 | 3288 | A postfix expression followed by a dot \tcode{.} or an arrow \tcode{->},
|
3289 | 3289 | optionally followed by the keyword
|
3290 |
| -\keyword{template}\iref{temp.names}, and then followed by an |
| 3290 | +\keyword{template}, and then followed by an |
3291 | 3291 | \grammarterm{id-expression}, is a postfix expression. The postfix
|
3292 | 3292 | expression before the dot or arrow is evaluated;
|
3293 | 3293 | \begin{footnote}
|
|
3300 | 3300 | the result of that evaluation, together with the
|
3301 | 3301 | \grammarterm{id-expression}, determines the result of the entire postfix
|
3302 | 3302 | expression.
|
| 3303 | +\begin{note} |
| 3304 | +If the keyword \keyword{template} is used, |
| 3305 | +the following unqualified name |
| 3306 | +is considered to refer to a template\iref{temp.names}. |
| 3307 | +If a \grammarterm{simple-template-id} results and is followed by a \tcode{::}, |
| 3308 | +the \grammarterm{id-expression} is a \grammarterm{qualified-id}. |
| 3309 | +\end{note} |
3303 | 3310 |
|
3304 | 3311 | \pnum
|
3305 | 3312 | \indextext{type!incomplete}%
|
|
3332 | 3339 | The class type shall be complete
|
3333 | 3340 | unless the class member access appears in the definition of that class.
|
3334 | 3341 | \begin{note}
|
3335 |
| -If the class is incomplete, |
3336 |
| -lookup in the complete class type is required to refer |
3337 |
| -to the same declaration\iref{basic.scope.class}. |
3338 |
| -\end{note} |
3339 |
| -The \grammarterm{id-expression} shall name a member of the class or of one of |
3340 |
| -its base classes. |
3341 |
| -\begin{note} |
3342 |
| -Because the name of a class is inserted in its class scope\iref{class}, |
3343 |
| -the name of a class is also considered a nested |
3344 |
| -member of that class. |
| 3342 | +The program is ill-formed if the result differs from that |
| 3343 | +when the class is complete\iref{class.member.lookup}. |
3345 | 3344 | \end{note}
|
3346 | 3345 | \begin{note}
|
3347 | 3346 | \ref{basic.lookup.qual} describes how names are looked up after the
|
|
3384 | 3383 | \tcode{mutable} member, then the type of \tcode{E1.E2} is
|
3385 | 3384 | ``\cvqual{cq12} \cvqual{vq12} \tcode{T}''.
|
3386 | 3385 |
|
3387 |
| -\item If \tcode{E2} is a (possibly overloaded) member function, |
| 3386 | +\item If \tcode{E2} is an overload set, |
3388 | 3387 | function overload resolution\iref{over.match}
|
3389 | 3388 | is used to select the function to which \tcode{E2} refers.
|
3390 | 3389 | The type of \tcode{E1.E2} is the type of \tcode{E2}
|
|
4360 | 4359 | \pnum
|
4361 | 4360 | \indextext{overloaded function!address of}%
|
4362 | 4361 | \begin{note}
|
4363 |
| -The address of an overloaded function\iref{over} can be taken |
4364 |
| -only in a context that uniquely determines which version of the |
4365 |
| -overloaded function is referred to (see~\ref{over.over}). |
| 4362 | +The address of an overload set\iref{over} can be taken |
| 4363 | +only in a context that uniquely determines |
| 4364 | +which function is referred to (see~\ref{over.over}). |
4366 | 4365 | Since the context might determine whether the operand is a static or
|
4367 | 4366 | non-static member function, the context can also affect whether the
|
4368 | 4367 | expression has type ``pointer to function'' or ``pointer to member
|
|
4474 | 4473 | An \grammarterm{await-expression} shall not appear in a
|
4475 | 4474 | default argument\iref{dcl.fct.default}.
|
4476 | 4475 | An \grammarterm{await-expression} shall not appear in the initializer of
|
4477 |
| -a block-scope variable with static or thread storage duration. |
| 4476 | +a block variable with static or thread storage duration. |
4478 | 4477 | A context within a function where an \grammarterm{await-expression} can appear
|
4479 | 4478 | is called a \term{suspension context} of the function.
|
4480 | 4479 |
|
|
4488 | 4487 | object\iref{dcl.fct.def.coroutine}
|
4489 | 4488 | of the enclosing coroutine and \tcode{P} is the type of that object.
|
4490 | 4489 |
|
4491 |
| -\item \placeholder{a} is the \grammarterm{cast-expression} if |
| 4490 | +\item Unless |
4492 | 4491 | the \grammarterm{await-expression} was implicitly produced by a
|
4493 | 4492 | \grammarterm{yield-expression}\iref{expr.yield}, an initial suspend point,
|
4494 |
| -or a final suspend point\iref{dcl.fct.def.coroutine}. |
4495 |
| -Otherwise, the \grammarterm{unqualified-id} \tcode{await_transform} is |
4496 |
| -looked up within the scope of \tcode{P} by class member access |
4497 |
| -lookup\iref{basic.lookup.qual}, |
4498 |
| -and if this lookup finds at least one declaration, then \placeholder{a} is |
| 4493 | +or a final suspend point\iref{dcl.fct.def.coroutine}, |
| 4494 | +a search is performed for the name \tcode{await_transform} |
| 4495 | +in the scope of \tcode{P} \iref{class.member.lookup}. |
| 4496 | +If this search is performed and finds at least one declaration, |
| 4497 | +then \placeholder{a} is |
4499 | 4498 | \mbox{\placeholder{p}\tcode{.await_transform(}\grammarterm{cast-expression}\tcode{)}};
|
4500 | 4499 | otherwise, \placeholder{a} is the \grammarterm{cast-expression}.
|
4501 | 4500 |
|
|
5040 | 5039 |
|
5041 | 5040 | \pnum
|
5042 | 5041 | \indextext{operator!scope resolution}%
|
5043 |
| -If the \grammarterm{new-expression} begins with a unary \tcode{::} |
5044 |
| -operator, the allocation function's name is looked up in the global |
5045 |
| -scope. Otherwise, if the allocated type is a class type \tcode{T} or |
5046 |
| -array thereof, the allocation function's name is looked up in the scope |
5047 |
| -of \tcode{T}. If this lookup fails to find the name, or if the allocated |
5048 |
| -type is not a class type, the allocation function's name is looked up in |
5049 |
| -the global scope. |
| 5042 | +If the \grammarterm{new-expression} |
| 5043 | +does not begin with a unary \tcode{::} operator and |
| 5044 | +the allocated type is a class type \tcode{T} or array thereof, |
| 5045 | +a search is performed for the allocation function's name in the scope |
| 5046 | +of \tcode{T}\iref{class.member.lookup}. |
| 5047 | +Otherwise, or if nothing is found, |
| 5048 | +the allocation function's name is looked up by |
| 5049 | +searching for it in the global scope. |
5050 | 5050 |
|
5051 | 5051 | \pnum
|
5052 | 5052 | An implementation is allowed to omit a call to a replaceable global allocation
|
|
5280 | 5280 | \pnum
|
5281 | 5281 | If the \grammarterm{new-expression} creates an object or an array of
|
5282 | 5282 | objects of class type, access and ambiguity control are done for the
|
5283 |
| -allocation function, the deallocation function\iref{class.free}, and |
| 5283 | +allocation function, the deallocation function\iref{basic.stc.dynamic.deallocation}, and |
5284 | 5284 | the constructor\iref{class.ctor} selected for the initialization (if any).
|
5285 | 5285 | If the \grammarterm{new-expression}
|
5286 | 5286 | creates an array of objects of class type, the destructor is potentially
|
|
5307 | 5307 | \end{note}
|
5308 | 5308 |
|
5309 | 5309 | \pnum
|
5310 |
| -If the \grammarterm{new-expression} begins with a unary \tcode{::} |
5311 |
| -operator, the deallocation function's name is looked up in the global |
5312 |
| -scope. Otherwise, if the allocated type is a class type \tcode{T} or an |
5313 |
| -array thereof, the deallocation function's name is looked up in the |
5314 |
| -scope of \tcode{T}. If this lookup fails to find the name, or if the |
5315 |
| -allocated type is not a class type or array thereof, the deallocation |
5316 |
| -function's name is looked up in the global scope. |
| 5310 | +If the \grammarterm{new-expression} does not begin with |
| 5311 | +a unary \tcode{::} operator and |
| 5312 | +the allocated type is a class type \tcode{T} or an array thereof, |
| 5313 | +a search is performed for the deallocation function's name |
| 5314 | +in the scope of \tcode{T}. |
| 5315 | +Otherwise, or if nothing is found, |
| 5316 | +the deallocation function's name is looked up by |
| 5317 | +searching for it in the global scope. |
5317 | 5318 |
|
5318 | 5319 | \pnum
|
5319 | 5320 | A declaration of a placement deallocation function matches the
|
|
5502 | 5503 | called as described above.
|
5503 | 5504 |
|
5504 | 5505 | \pnum
|
| 5506 | +If a deallocation function is called, |
| 5507 | +it is \tcode{operator delete} for a single-object delete expression or |
| 5508 | +\tcode{operator delete[]} for an array delete expression. |
5505 | 5509 | \begin{note}
|
5506 |
| -An implementation provides default definitions of the global |
5507 |
| -deallocation functions \tcode{operator delete} for |
5508 |
| -non-arrays\iref{new.delete.single} and |
5509 | 5510 | \indextext{\idxcode{operator delete}}%
|
5510 |
| -\tcode{operator delete[]} for arrays\iref{new.delete.array}. A \Cpp{} |
5511 |
| -program can provide alternative definitions of these |
| 5511 | +An implementation provides default definitions of the global |
| 5512 | +deallocation functions (\ref{new.delete.single}, \ref{new.delete.array}). |
| 5513 | +A \Cpp{} program can provide alternative definitions of these |
5512 | 5514 | functions\iref{replacement.functions}, and/or class-specific
|
5513 | 5515 | versions\iref{class.free}.
|
5514 | 5516 | \end{note}
|
5515 | 5517 |
|
5516 | 5518 | \pnum
|
5517 |
| -When the keyword \tcode{delete} in a \grammarterm{delete-expression} is |
5518 |
| -preceded by the unary \tcode{::} operator, the deallocation function's name is looked |
5519 |
| -up in global scope. Otherwise, the lookup considers class-specific deallocation |
5520 |
| -functions\iref{class.free}. If no class-specific deallocation function is found, |
5521 |
| -the deallocation function's name is looked up in global scope. |
| 5519 | +If the keyword \tcode{delete} in a \grammarterm{delete-expression} |
| 5520 | +is not preceded by the unary \tcode{::} operator and the type of the operand is |
| 5521 | +a pointer to a (possibly cv-qualified) class type \tcode{T}: |
| 5522 | +\begin{itemize} |
| 5523 | +\item |
| 5524 | +If \tcode{T} has a virtual destructor, |
| 5525 | +the deallocation function is the one selected at the point of definition of |
| 5526 | +the dynamic type's virtual destructor\iref{class.dtor}. |
| 5527 | +\item |
| 5528 | +Otherwise, |
| 5529 | +a search is performed for the deallocation function's name |
| 5530 | +in the scope of \tcode{T}. |
| 5531 | +\end{itemize} |
| 5532 | +Otherwise, or if nothing is found, |
| 5533 | +the deallocation function's name is looked up by |
| 5534 | +searching for it in the global scope. |
| 5535 | +In any case, any declarations |
| 5536 | +other than of usual deallocation functions\iref{basic.stc.dynamic.deallocation} |
| 5537 | +are discarded. |
| 5538 | +\begin{note} |
| 5539 | +If only a placement deallocation function is found in a class, |
| 5540 | +the program is ill-formed because the lookup set is empty\iref{basic.lookup}. |
| 5541 | +\end{note} |
5522 | 5542 |
|
5523 | 5543 | \pnum
|
5524 |
| -If deallocation function lookup finds more than one usual |
5525 |
| -deallocation function, |
| 5544 | +If more than one deallocation function is found, |
5526 | 5545 | the function to be called is selected as follows:
|
5527 | 5546 | \begin{itemize}
|
5528 | 5547 | \item
|
|
5539 | 5558 | If exactly one function remains,
|
5540 | 5559 | that function is selected and the selection process terminates.
|
5541 | 5560 | \item
|
5542 |
| -If the deallocation functions have class scope, |
| 5561 | +If the deallocation functions belong to a class scope, |
5543 | 5562 | the one without a parameter of type \tcode{std::size_t} is selected.
|
5544 | 5563 | \item
|
5545 | 5564 | If the type is complete
|
|
7433 | 7452 | \pnum
|
7434 | 7453 | An expression or conversion is in an \defn{immediate function context}
|
7435 | 7454 | if it is potentially evaluated and
|
7436 |
| -its innermost non-block scope is |
| 7455 | +its innermost enclosing non-block scope is |
7437 | 7456 | a function parameter scope of an immediate function.
|
7438 | 7457 | An expression or conversion is an \defn{immediate invocation}
|
7439 | 7458 | if it is a potentially-evaluated explicit or implicit invocation of
|
|
7525 | 7544 | that is potentially constant evaluated, or
|
7526 | 7545 |
|
7527 | 7546 | \item
|
7528 |
| -a variable whose name appears as a potentially constant evaluated expression |
| 7547 | +a variable named by a potentially constant evaluated expression |
7529 | 7548 | that is either a constexpr variable or
|
7530 | 7549 | is of non-volatile const-qualified integral type or of reference type.
|
7531 | 7550 | \end{itemize}
|
|
0 commit comments