blob: 86a7e63c8090e5adad53d9aa8ee668db14f40d82 [file]
// { dg-do run { target c++11 } }
// { dg-additional-options "-pthread" { target pthread } }
// { dg-require-gthreads "" }
// Bug 128548 - std::thread::join should check to make sure id is not self
#include <thread>
#include <system_error>
#include <testsuite_hooks.h>
int main()
{
std::error_code ec;
std::thread t;
t = std::thread{ [&] {
try
{
t.join();
}
catch (const std::system_error& e)
{
ec = e.code();
}
}};
t.join();
VERIFY( ec == std::errc::resource_deadlock_would_occur );
}