| 1 |
// { dg-do run { target c++14 } } |
| 2 |
// { dg-require-gthreads "" } |
| 3 |
// { dg-additional-options "-pthread" { target pthread } } |
| 4 |
|
| 5 |
#include <shared_mutex> |
| 6 |
#include <system_error> |
| 7 |
#include <testsuite_hooks.h> |
| 8 |
|
| 9 |
// PR libstdc++/112089 shared_lock::unlock should throw operation_not_permitted |
| 10 |
|
| 11 |
int main() |
| 12 |
{ |
| 13 |
std::shared_lock<std::shared_timed_mutex> l; |
| 14 |
try |
| 15 |
{ |
| 16 |
l.unlock(); |
| 17 |
VERIFY( false ); |
| 18 |
} |
| 19 |
catch (const std::system_error& e) |
| 20 |
{ |
| 21 |
VERIFY( e.code() == std::errc::operation_not_permitted ); |
| 22 |
} |
| 23 |
} |