This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.

1466. Silent const breakage by compare_exchange_* member functions

Section: 99 [atomics.types.address] Status: Resolved Submitter: INCITS Opened: 2010-08-25 Last modified: 2016-01-28

Priority: Not Prioritized

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

View all issues with Resolved status.

Discussion:

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*.

[ Proposed resolution as of NB comment: ]

Change 99 [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;
  [..]
}

[ 2010-10-27 Daniel adds: ]

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

[ Resolved in Batavia by accepting n3193. ]

Proposed resolution:

Solved by n3193.