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.
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-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.
[ 2010-10-27 Daniel adds: ]
Resolving this issue will also solve 1469
Accepting n3164 would solve this issue by removing atomic_address.
[ Resolved in Batavia by accepting n3193. ]
Proposed resolution:
namespace std { template <class T> struct atomic<T*>: atomic_address{ [..] }; [..] }
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.