Title
Deriving atomic<T*> from atomic_address breaks type safety
Status
resolved
Section
[atomics.types.address]
Submitter
INCITS

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

Messages

Date: 2010-11-13.02:14:14

Proposed resolution:

  1. Change [atomics.types.generic], class template specialization atomic<T*> synopsis, as indicated:
    namespace std {
      template <class T> struct atomic<T*> : atomic_address {
        [..]
      };
      [..]
    }
    
  2. Change [atomics.types.generic] p. 4 as indicated:

    4 There are pointer partial specializations on the atomic class template. These specializations shall be publicly derived from atomic_address. The unit of addition/subtraction for these specializations shall be the size of the referenced type. These specializations shall have trivial default constructors and trivial destructors.

Date: 2010-11-13.02:14:14

[ Resolved in Batavia by accepting n3193. ]

Date: 2010-10-27.00:00:00

[ 2010-10-27 Daniel adds: ]

Resolving this issue will also solve 1469

Accepting n3164 would solve this issue by removing atomic_address.

Date: 2010-10-27.20:02:48

Addresses US-163

Requiring atomic<T*> to be derived from atomic_address breaks type safety:

atomic<double*> ip;
char ch;
atomic_store(&ip, &ch);
*ip.load() = 3.14159;

The last line overwrites ch with a value of type double.

History
Date User Action Args
2010-11-18 12:46:23adminsetstatus: nad editorial -> resolved
2010-11-13 02:14:14adminsetmessages: + msg5348
2010-11-13 02:14:14adminsetstatus: open -> nad editorial
2010-10-27 20:02:48adminsetmessages: + msg5169
2010-10-27 20:02:48adminsetmessages: + msg5168
2010-08-25 00:00:00admincreate