Hi all,

We noticed that the C++11 spec guarantees that std::atomic<bool> has a trivial constructor and a trivial destructor, but these three guarantees were lost in the C++17 spec and onward.

        (§29.5) 4. … There shall be a specialization atomic<bool> which provides the general atomic operations as specified in 29.6.1.
        (§29.5) 5. The atomic integral specializations and the specialization atomic<bool> shall have standard layout. They shall each have a trivial default constructor and a trivial destructor. They shall each support aggregate initialization syntax.
        (§32.6) 2. The specialization atomic<bool> is a standard-layout struct.
        (§32.6.2 ) 1. … [ Note: For the specialization atomic<bool>, see 32.6. — end note ]

The change occurred in P0558, and as far as we can tell, was not intentional. A brief experiment using godbolt.org shows that std::atomic<bool> is indeed trivially constructible and trivially destructible on the current versions of all listed compilers.

Is this a defect in the current spec? Thanks!

--Jeremy Hurwitz & Matt Maly