This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of WP status.
std::atomic<bool>
's trivial destructor dropped in C++17 spec wordingSection: 32.5.8.1 [atomics.types.generic.general] Status: WP Submitter: Jeremy Hurwitz Opened: 2023-06-20 Last modified: 2023-11-22
Priority: Not Prioritized
View all issues with WP status.
Discussion:
std::atomic<bool>
was originally required to have a trivial default constructor and a trivial destructor
[C++11 N3337: Section [atomics.types.generic], Paragraph 5],
the same as the integral [C++11 N3337: Section [atomics.types.generic],
Paragraph 5] and pointer specializations [C++11 N3337:
Section [atomics.types.generic], Paragraph 6]. P0558 rearranged the text,
accidentally (as far as we can tell) removing the constructor and destructor requirements from std::atomic<bool>
,
which has the surprising effect that std::atomic<bool>
has no longer the same constructor/destructor
guarantees as std::atomic<int>
.
[2023-10-27; Reflector poll]
Set status to Tentatively Ready after eight votes in favour during reflector poll.
[2023-11-11 Approved at November 2023 meeting in Kona. Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N4950.
Modify 32.5.8.1 [atomics.types.generic.general] as indicated:
-1- […]
-2- The specializationatomic<bool>
is a standard-layout struct. It has a trivial destructor.