cplusplus / CWG

Core Working Group
23 stars 7 forks source link

[intro.races] p13 "non-atomic scalar object" or its opposite("atomic scalar object") is underspecified LWG2506 #397

Closed xmh0511 closed 1 year ago

xmh0511 commented 1 year ago

Full name of submitter (unless configured in github; will be published with the issue): Jim X

[intro.races] p13:

A visible side effect A on a scalar object or bit-field M with respect to a value computation B of M satisfies the conditions:

  • [...]

The value of a non-atomic scalar object or bit-field M, as determined by evaluation B, shall be the value stored by the visible side effect A.

The literal meaning of "scalar object" presumably refers to that an object of scalar type, where the scalar type is defined in [basic.types.general] p9. So, what does "non-atomic scalar object" mean here? In other words, the opposite of a "non-atomic scalar object" is an "atomic scalar object", however, atomic is a class template, that is, any specialization of it is a class type, as per [atomics.types.generic], an object of type atomic<T> where T is a scalar type is not a scalar object.

frederick-vs-ja commented 1 year ago

Looks like a duplicate of #96 and LWG2506.