[Bug libstdc++/49445] Undefined reference to std::atomic<float> "operator float"
indi.in.the.wired at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Jun 26 08:37:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49445
Mark A. Gibbs <indi.in.the.wired at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |indi.in.the.wired at gmail
| |dot com
--- Comment #6 from Mark A. Gibbs <indi.in.the.wired at gmail dot com> 2011-06-26 08:37:09 UTC ---
(In reply to comment #5)
> You are right, I thought it worked for all fundamental types but reviewing the
> proposal [1] makes me realise I was wrong. It remains unclear wether user
> defined enums should work ...
According to 29.5.1 in the draft standard i have (n3242):
"There is a generic class template atomic<T>. The type of the template argument
T shall be trivially copyable (3.9)."
That wording is in several older drafts, too, going back to at least March
2010, so it's not new and probably won't change.
So it *should* work for all fundamental types, and even user-defined types
(classes) provided they're trivially copyable. Both float and scoped enums are
trivially copyable, so atomic<float> and atomic<some_enum_class_type> should
work.
What the standard says about integral types is just that specializations
already exist for them (like specialization atomic<int> exists, and publicly
inherits from atomic_int).
More information about the Gcc-bugs
mailing list