This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of CD1 status.
Section: 33.5.8 [atomics.types.generic] Status: CD1 Submitter: Alisdair Meredith Opened: 2008-06-03 Last modified: 2016-01-28
Priority: Not Prioritized
View all other issues in [atomics.types.generic].
View all issues with CD1 status.
Discussion:
The atomic classes (and class templates) are required to support aggregate initialization (99 [atomics.types.integral] p. 2 / 99 [atomics.types.address] p. 1) yet also have user declared constructors, so cannot be aggregates.
This problem might be solved with the introduction of the proposed initialization syntax at Antipolis, but the wording above should be altered. Either strike the sentence as redundant with new syntax, or refer to 'brace initialization'.
[ Jens adds: ]
Note that
atomic_itype a1 = { 5 };would be aggregate-initialization syntax (now coming under the disguise of brace initialization), but would be ill-formed, because the corresponding constructor for atomic_itype is explicit. This works, though:
atomic_itype a2 { 6 };
[ San Francisco: ]
The preferred approach to resolving this is to remove the explicit specifiers from the atomic integral type constructors.
Lawrence will provide wording.
This issue is addressed in N2783.
Proposed resolution:
within the synopsis in 99 [atomics.types.integral] edit as follows.
.... typedef struct atomic_bool { .... constexpr
explicitatomic_bool(bool); .... typedef struct atomic_itype { .... constexprexplicitatomic_itype(integral); ....
edit 99 [atomics.types.integral] paragraph 2 as follows.
The atomic integral types shall have standard layout. They shall each have a trivial default constructor, a constexpr
explicitvalue constructor, a deleted copy constructor, a deleted copy assignment operator, and a trivial destructor. They shall each support aggregate initialization syntax.
within the synopsis of 99 [atomics.types.address] edit as follows.
.... typedef struct atomic_address { .... constexpr
explicitatomic_address(void*); ....
edit 99 [atomics.types.address] paragraph 1 as follows.
The type
atomic_address
shall have standard layout. It shall have a trivial default constructor, a constexprexplicitvalue constructor, a deleted copy constructor, a deleted copy assignment operator, and a trivial destructor. It shall support aggregate initialization syntax.
within the synopsis of 33.5.8 [atomics.types.generic] edit as follows.
.... template <class T> struct atomic { .... constexpr
explicitatomic(T); .... template <> struct atomic<integral> : atomic_itype { .... constexprexplicitatomic(integral); .... template <> struct atomic<T*> : atomic_address { .... constexprexplicitatomic(T*); ....
edit 33.5.8 [atomics.types.generic] paragraph 2 as follows.
Specializations of the
atomic
template shall have a deleted copy constructor, a deleted copy assignment operator, and a constexprexplicitvalue constructor.