Title
Deleted assignment operators for atomic types must be volatile
Status
resolved
Section
[atomics.types.generic]
Submitter
Anthony Williams

Created on 2008-09-26.00:00:00 last changed 169 months ago

Messages

Date: 2010-10-21.18:28:33

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.

Date: 2010-12-05.14:14:49

[ 2009-10 Santa Cruz: ]

NAD EditorialResolved. Addressed by N2992.

Date: 2009-08-17.00:00:00

[ 2009-08-17 Handled by N2925. ]

Date: 2010-10-21.18:28:33

[ Summit: ]

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

Date: 2008-09-26.00:00:00

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.

History
Date User Action Args
2010-12-05 14:14:49adminsetstatus: nad editorial -> resolved
2010-10-21 18:28:33adminsetmessages: + msg4312
2010-10-21 18:28:33adminsetmessages: + msg4311
2010-10-21 18:28:33adminsetmessages: + msg4310
2010-10-21 18:28:33adminsetmessages: + msg4309
2008-09-26 00:00:00admincreate