This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/53901] [C++11] std::atomic<T> fails for type without no-throw default constructor
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 09 Jul 2012 17:31:25 +0000
- Subject: [Bug libstdc++/53901] [C++11] std::atomic<T> fails for type without no-throw default constructor
- Auto-submitted: auto-generated
- References: <bug-53901-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53901
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[C++11] std::atomic<T> |[C++11] std::atomic<T>
|fails for type without |fails for type without
|trivial default constructor |no-throw default
|and trivial destructor |constructor
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-07-09 17:31:25 UTC ---
In my testccase T isn't trivially copyable because of its non-trivial
destructor, so only the constructor is relevant.
The fact G++ accepts it if the constructor is defaulted after its first
declaration is now PR 53903
N.B. it fails even if the default constructor isn't used:
#include <atomic>
struct T {
T() noexcept(false) { }
};
std::atomic<T> a{ T{} };
This appears to be a defect in the standard rather than a libstdc++ bug.