Skip to content

[basic.life][class.dtor] Turn normatively redundant paragraphs for double destruction into notes #6389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions source/basic.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3622,22 +3622,21 @@
\end{note}

\pnum
If a program ends the lifetime of an object of type \tcode{T} with
static\iref{basic.stc.static}, thread\iref{basic.stc.thread},
or automatic\iref{basic.stc.auto}
storage duration and if \tcode{T} has a non-trivial destructor,
\begin{note}
If a program ends the lifetime of an object for which a destructor
will be called implicitly,
\begin{footnote}
That
is, an object for which a destructor will be called
implicitly---upon exit from the block for an object with
automatic storage duration, upon exit from the thread for an object with
thread storage duration, or upon exit from the program for an object
with static storage duration.
The destructor will be called upon exit from the block for an object with
automatic storage duration\iref{basic.stc.auto}, upon exit from the thread
for an object with thread storage duration\iref{basic.stc.thread}, or upon
exit from the program for an object with
static storage duration\iref{basic.stc.static}.
\end{footnote}
and another object of the original type does not occupy
that same storage location when the implicit destructor call takes
place, the behavior of the program is undefined. This is true
even if the block is exited with an exception.
and the object is not transparently replaceable by another object that is
within its lifetime when the implicit destructor call takes place,
the behavior of the program is undefined. This is true even if the block is
exited with an exception.
\end{note}
\begin{example}
\begin{codeblock}
class T { };
Expand Down
2 changes: 2 additions & 0 deletions source/classes.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2270,9 +2270,11 @@
\end{note}

\pnum
\begin{note}
Once a destructor is invoked for an object, the object's lifetime ends;
the behavior is undefined if the destructor is invoked
for an object whose lifetime has ended\iref{basic.life}.
\end{note}
\begin{example}
If the destructor for an object with automatic storage duration is explicitly invoked,
and the block is subsequently left in a manner that would ordinarily
Expand Down