Skip to content

Commit 50a457a

Browse files
committed
CWG2929 Lifetime of trivially-destructible static or thread-local objects
1 parent 00e313b commit 50a457a

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

source/basic.tex

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7496,7 +7496,7 @@
74967496
\indextext{program!termination|(}%
74977497
\indextext{object!destructor static}%
74987498
\indextext{\idxcode{main} function!return from}%
7499-
Constructed objects\iref{dcl.init}
7499+
Constructed complete objects\iref{dcl.init}
75007500
with static storage duration are destroyed
75017501
and functions registered with \tcode{std::atexit}
75027502
are called as part of a call to
@@ -7510,13 +7510,29 @@
75107510
\end{note}
75117511

75127512
\pnum
7513-
Constructed objects with thread storage duration within a given thread
7513+
Constructed complete objects with thread storage duration within a given thread
75147514
are destroyed as a result of returning from the initial function of that thread and as a
75157515
result of that thread calling \tcode{std::exit}.
7516-
The destruction of all constructed objects with thread storage
7517-
duration within that thread strongly happens before destroying
7516+
The destruction of those constructed objects
7517+
is sequenced before releasing the storage for
7518+
any object with thread storage duration within that thread\iref{basic.stc.thread}.
7519+
The destruction of those constructed objects
7520+
strongly happens before destroying
75187521
any object with static storage duration.
75197522

7523+
\pnum
7524+
The destruction of a complete object with thread storage duration within a given thread
7525+
and having constant destruction\iref{expr.const}
7526+
is sequenced after the destruction of any other complete object
7527+
with thread storage duration within the thread.
7528+
The destruction of a complete object with static storage duration
7529+
and having constant destruction
7530+
is sequenced after the destruction of any other complete object
7531+
with static storage duration
7532+
and after any call to a function passed to \tcode{std::atexit}.
7533+
The sequencing rules in the remainder of this subclause
7534+
apply only to complete objects not having constant destruction.
7535+
75207536
\pnum
75217537
If the completion of the constructor or dynamic initialization of an object with static
75227538
storage duration strongly happens before that of another, the completion of the destructor

0 commit comments

Comments
 (0)