Title
Silent const breakage by compare_exchange_* member functions
Status
resolved
Section
[atomics.types.address]
Submitter
INCITS

Created on 2010-08-25.00:00:00 last changed 170 months ago

Messages

Date: 2011-05-21.21:15:19

Proposed resolution:

Solved by n3193.

Date: 2010-11-18.12:46:23

[ Resolved in Batavia by accepting n3193. ]

Date: 2010-10-27.00:00:00

[ 2010-10-27 Daniel adds: ]

Accepting n3164 would solve this issue by replacing atomic_address by atomic<void*>.

Date: 2010-11-13.13:49:23

[ Proposed resolution as of NB comment: ]

Change [atomics.types.address], class atomic_address synopsis, as indicated:

namespace std {
  typedef struct atomic_address {
    [..]
    bool compare_exchange_weak(const void*&, const void*,
      memory_order, memory_order) volatile;
    bool compare_exchange_weak(const void*&, const void*,
      memory_order, memory_order);
    bool compare_exchange_strong(const void*&, const void*,
      memory_order, memory_order) volatile;
    bool compare_exchange_strong(const void*&, const void*,
      memory_order, memory_order);
    bool compare_exchange_weak(const void*&, const void*,
      memory_order = memory_order_seq_cst) volatile;
    bool compare_exchange_weak(const void*&, const void*,
      memory_order = memory_order_seq_cst);
    bool compare_exchange_strong(const void*&, const void*,
      memory_order = memory_order_seq_cst) volatile;
    bool compare_exchange_strong(const void*&, const void*,
      memory_order = memory_order_seq_cst);
    [..]
  } atomic_address;
  [..]
}
Date: 2010-10-24.03:04:13

Addresses US-162

The compare_exchange_weak and compare_exchange_strong member functions that take const void* arguments lead to a silent removal of const, because the load member function and other acessors return the stored value as a void*.

History
Date User Action Args
2010-11-18 12:46:23adminsetmessages: + msg5389
2010-11-18 12:46:23adminsetmessages: + msg5388
2010-11-18 12:46:23adminsetstatus: nad editorial -> resolved
2010-11-13 13:49:23adminsetstatus: open -> nad editorial
2010-10-27 20:02:48adminsetmessages: + msg5167
2010-10-27 20:02:48adminsetmessages: + msg5166
2010-10-24 03:04:13adminsetmessages: + msg4954
2010-08-25 00:00:00admincreate