summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/29_atomics/atomic/lwg3220.cc
blob: ba289e197dca35132e6832fd9f04c969880aa8d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// { dg-do compile { target c++11 } }

// std::shared_ptr is not freestanding.
// { dg-require-effective-target hosted }

// 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>());
}