[cfe-dev] [libcxx] std::atomic default constructor
Stephan Tolksdorf
st at quanttec.com
Fri Mar 15 12:50:33 PDT 2013
Hi,
Is there a reason that the default constructors for the std::atomic
types in libc++'s <atomic> are not explicitly defaulted? In the header
the "= default" is commented out and instead a trivial constructor is
explicitly defined. This leads to non-standard behaviour, because value
initialization doesn't zero-initialize the atomic value.
For example, the default constructor of the following struct Test does
not zero-initialize atomicValue as expected:
struct Test {
int value{}; // is zero-initialized
std::atomic<int> atomicValue{}; // is not zero-initialized
};
Best regards,
Stephan
More information about the cfe-dev
mailing list