libstdc++-v3/testsuite/30_threads/thread/106695.cc
raw| 1 | // { dg-do compile { target c++11 } } |
| 2 | // { dg-require-gthreads "" } |
| 3 | |
| 4 | // PR libstdc++/106695 |
| 5 | // Explicit copy constructor does not work for a parameter passed via std::async |
| 6 | |
| 7 | #include <thread> |
| 8 | |
| 9 | struct A { |
| 10 | A() = default; |
| 11 | explicit A(const A&) = default; |
| 12 | }; |
| 13 | |
| 14 | void func(const A&) { } |
| 15 | |
| 16 | void |
| 17 | test_thread() |
| 18 | { |
| 19 | std::thread t(func, A{}); |
| 20 | t.join(); |
| 21 | } |