Title
std::atomic<bool>'s trivial destructor dropped in C++17 spec wording
Status
wp
Section
[atomics.types.generic.general]
Submitter
Jeremy Hurwitz

Created on 2023-06-20.00:00:00 last changed 13 months ago

Messages

Date: 2023-11-13.14:08:10

Proposed resolution:

This wording is relative to N4950.

  1. Modify [atomics.types.generic.general] as indicated:

    -1- […]

    -2- The specialization atomic<bool> is a standard-layout struct. It has a trivial destructor.

Date: 2023-11-11.00:00:00

[ 2023-11-11 Approved at November 2023 meeting in Kona. Status changed: Voting → WP. ]

Date: 2023-10-15.00:00:00

[ 2023-10-27; Reflector poll ]

Set status to Tentatively Ready after eight votes in favour during reflector poll.

Date: 2023-06-20.00:00:00

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>.

C++20 removed the "trivial default constructor" requirement from all specializations. A specialization for floating-point types was added with a trivial destructor [N4861: Section [atomics.types.float], Paragraph 2)].

History
Date User Action Args
2023-11-13 14:08:10adminsetmessages: + msg13845
2023-11-13 14:08:10adminsetstatus: voting -> wp
2023-11-07 21:41:54adminsetstatus: ready -> voting
2023-10-27 21:22:44adminsetmessages: + msg13764
2023-10-27 21:22:44adminsetstatus: new -> ready
2023-06-25 09:23:01adminsetmessages: + msg13664
2023-06-20 00:00:00admincreate