Created on 2016-11-09.00:00:00 last changed 97 months ago
[ Issues Telecon 16-Dec-2016 ]
Resolved by adoption of P0521R0.
Addresses CA 14
The removal of the "debug only" restriction for use_count() and unique() in shared_ptr introduced a bug: in order for unique() to produce a useful and reliable value, it needs a synchronize clause to ensure that prior accesses through another reference are visible to the successful caller of unique(). Many current implementations use a relaxed load, and do not provide this guarantee, since it's not stated in the Standard. For debug/hint usage that was OK. Without it the specification is unclear and misleading.
Proposed change:
A solution could make unique() use memory_order_acquire, and specifying that reference count decrement operations synchronize with unique(). This won't provide sequential consistency but may be useful. We could also specify use_count() as only providing an unreliable hint of the actual count, or deprecate it.History | |||
---|---|---|---|
Date | User | Action | Args |
2016-12-16 20:56:38 | admin | set | messages: + msg8741 |
2016-12-16 20:56:38 | admin | set | status: new -> resolved |
2016-11-09 00:00:00 | admin | create |