|
3383 | 3383 | program has undefined behavior if:
|
3384 | 3384 | \begin{itemize}
|
3385 | 3385 | \item
|
3386 |
| - the object will be or was of a class type with a non-trivial destructor |
3387 |
| - and the pointer is used as the operand of a \grammarterm{delete-expression}, |
| 3386 | + the pointer is used to destroy the object |
| 3387 | + (\ref{expr.prim.id.dtor}, \ref{expr.delete}) |
3388 | 3388 | \item
|
3389 | 3389 | the pointer is used to access a non-static data member or call a
|
3390 | 3390 | non-static member function of the object, or
|
|
3447 | 3447 | well-defined. The program has undefined behavior if:
|
3448 | 3448 | \begin{itemize}
|
3449 | 3449 | \item the glvalue is used to access the object, or
|
| 3450 | +\item the glvalue is used to destroy the object\iref{expr.prim.id.dtor}, or |
3450 | 3451 | \item the glvalue is used to call a non-static member function of the object, or
|
3451 | 3452 | \item the glvalue is bound to a reference to a virtual base class\iref{dcl.init.ref}, or
|
3452 | 3453 | \item the glvalue is used as the operand of a
|
|
3516 | 3517 | If a program ends the lifetime of an object of type \tcode{T} with
|
3517 | 3518 | static\iref{basic.stc.static}, thread\iref{basic.stc.thread},
|
3518 | 3519 | or automatic\iref{basic.stc.auto}
|
3519 |
| -storage duration and if \tcode{T} has a non-trivial destructor, |
| 3520 | +storage duration, |
3520 | 3521 | \begin{footnote}
|
3521 | 3522 | That
|
3522 |
| -is, an object for which a destructor will be called |
| 3523 | +is, an object that is destroyed |
3523 | 3524 | implicitly---upon exit from the block for an object with
|
3524 | 3525 | automatic storage duration, upon exit from the thread for an object with
|
3525 | 3526 | thread storage duration, or upon exit from the program for an object
|
3526 | 3527 | with static storage duration.
|
3527 | 3528 | \end{footnote}
|
3528 | 3529 | and another object of the original type does not occupy
|
3529 |
| -that same storage location when the implicit destructor call takes |
| 3530 | +that same storage location when the implicit destruction takes |
3530 | 3531 | place, the behavior of the program is undefined. This is true
|
3531 | 3532 | even if the block is exited with an exception.
|
3532 | 3533 | \begin{example}
|
|
6633 | 6634 |
|
6634 | 6635 | \pnum
|
6635 | 6636 | If the completion of the constructor or dynamic initialization of an object with static
|
6636 |
| -storage duration strongly happens before that of another, the completion of the destructor |
6637 |
| -of the second is sequenced before the initiation of the destructor of the first. |
| 6637 | +storage duration strongly happens before that of another, the completion of the destruction |
| 6638 | +of the second is sequenced before the initiation of the destruction of the first. |
6638 | 6639 | If the completion of the constructor or dynamic initialization of an object with thread
|
6639 |
| -storage duration is sequenced before that of another, the completion of the destructor |
6640 |
| -of the second is sequenced before the initiation of the destructor of the first. |
| 6640 | +storage duration is sequenced before that of another, the completion of the destruction |
| 6641 | +of the second is sequenced before the initiation of the destruction of the first. |
6641 | 6642 | If an object is
|
6642 | 6643 | initialized statically, the object is destroyed in the same order as if
|
6643 | 6644 | the object was dynamically initialized. For an object of array or class
|
|
6665 | 6666 | If the completion of the initialization of an object with static storage
|
6666 | 6667 | duration strongly happens before a call to \tcode{std::atexit}~(see
|
6667 | 6668 | \libheader{cstdlib}, \ref{support.start.term}), the call to the function passed to
|
6668 |
| -\tcode{std::atexit} is sequenced before the call to the destructor for the object. If a |
| 6669 | +\tcode{std::atexit} is sequenced before the destruction of the object. If a |
6669 | 6670 | call to \tcode{std::atexit} strongly happens before the completion of the initialization of
|
6670 |
| -an object with static storage duration, the call to the destructor for the |
| 6671 | +an object with static storage duration, the destruction of the |
6671 | 6672 | object is sequenced before the call to the function passed to \tcode{std::atexit}. If a
|
6672 | 6673 | call to \tcode{std::atexit} strongly happens before another call to \tcode{std::atexit}, the
|
6673 | 6674 | call to the function passed to the second \tcode{std::atexit} call is sequenced before
|
|
0 commit comments