908. Deleted assignment operators for atomic types must be volatile

Section: 32.6 [atomics.types.generic] Status: Resolved Submitter: Anthony Williams Opened: 2008-09-26 Last modified: 2017-12-02

Priority: Not Prioritized

View all other issues in [atomics.types.generic].

View all issues with Resolved status.

Discussion:

Addresses US 90

The deleted copy-assignment operators for the atomic types are not marked as volatile in N2723, whereas the assignment operators from the associated non-atomic types are. e.g.

atomic_bool& operator=(atomic_bool const&) = delete;
atomic_bool& operator=(bool) volatile;

This leads to ambiguity when assigning a non-atomic value to a non-volatile instance of an atomic type:

atomic_bool b;
b=false;

Both assignment operators require a standard conversions: the copy-assignment operator can use the implicit atomic_bool(bool) conversion constructor to convert false to an instance of atomic_bool, or b can undergo a qualification conversion in order to use the assignment from a plain bool.

This is only a problem once issue 845 is applied.

[ Summit: ]

Move to open. Assign to Lawrence. Related to US 90 comment.

[ 2009-08-17 Handled by N2925. ]

[ 2009-10 Santa Cruz: ]

NAD EditorialResolved. Addressed by N2992.

Proposed resolution:

Add volatile qualification to the deleted copy-assignment operator of all the atomic types:

atomic_bool& operator=(atomic_bool const&) volatile = delete;
atomic_itype& operator=(atomic_itype const&) volatile = delete;

etc.

This will mean that the deleted copy-assignment operator will require two conversions in the above example, and thus be a worse match than the assignment from plain bool.