aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libstdc++-v3/include/std/atomic4
-rw-r--r--libstdc++-v3/testsuite/29_atomics/atomic/lwg3220.cc13
2 files changed, 16 insertions, 1 deletions
diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic
index 1c6acfa..70055b8 100644
--- a/libstdc++-v3/include/std/atomic
+++ b/libstdc++-v3/include/std/atomic
@@ -1244,8 +1244,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ atomic_flag_clear_explicit(__a, memory_order_seq_cst); }
/// @cond undocumented
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 3220. P0558 broke conforming C++14 uses of atomic shared_ptr
template<typename _Tp>
- using __atomic_val_t = typename atomic<_Tp>::value_type;
+ using __atomic_val_t = __type_identity_t<_Tp>;
template<typename _Tp>
using __atomic_diff_t = typename atomic<_Tp>::difference_type;
/// @endcond
diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/lwg3220.cc b/libstdc++-v3/testsuite/29_atomics/atomic/lwg3220.cc
new file mode 100644
index 0000000..d2ff6cf
--- /dev/null
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/lwg3220.cc
@@ -0,0 +1,13 @@
+// { dg-do compile { target c++11 } }
+// DR 3220. P0558 broke conforming C++14 uses of atomic shared_ptr
+
+#include <atomic>
+#include <memory>
+
+struct Abstract { virtual void test() = 0; };
+struct Concrete : Abstract { virtual void test() override {} };
+
+int main() {
+ std::shared_ptr<Abstract> ptr;
+ std::atomic_store<Abstract>(&ptr, std::make_shared<Concrete>());
+}