1218822Sdim// { dg-do run { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } }
2218822Sdim// { dg-options " -std=gnu++14 -pthread" { target *-*-freebsd* *-*-dragonfly* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } }
3218822Sdim// { dg-options " -std=gnu++14 -pthreads" { target *-*-solaris* } }
4218822Sdim// { dg-options " -std=gnu++14 " { target *-*-cygwin *-*-darwin* } }
5218822Sdim// { dg-require-cstdint "" }
6218822Sdim// { dg-require-gthreads "" }
7218822Sdim
8218822Sdim// Copyright (C) 2013-2015 Free Software Foundation, Inc.
9218822Sdim//
10218822Sdim// This file is part of the GNU ISO C++ Library.  This library is free
11218822Sdim// software; you can redistribute it and/or modify it under the
12218822Sdim// terms of the GNU General Public License as published by the
13218822Sdim// Free Software Foundation; either version 3, or (at your option)
14218822Sdim// any later version.
15218822Sdim
16218822Sdim// This library is distributed in the hope that it will be useful,
17218822Sdim// but WITHOUT ANY WARRANTY; without even the implied warranty of
18218822Sdim// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19218822Sdim// GNU General Public License for more details.
20218822Sdim
21218822Sdim// You should have received a copy of the GNU General Public License along
22218822Sdim// with this library; see the file COPYING3.  If not see
23218822Sdim// <http://www.gnu.org/licenses/>.
24218822Sdim
25218822Sdim
26218822Sdim#include <shared_mutex>
27218822Sdim#include <system_error>
28218822Sdim#include <testsuite_hooks.h>
29218822Sdim
30218822Sdimint main()
31218822Sdim{
32218822Sdim  bool test __attribute__((unused)) = true;
33218822Sdim  typedef std::shared_timed_mutex mutex_type;
34218822Sdim  typedef std::shared_lock<mutex_type> lock_type;
35218822Sdim
36218822Sdim  try
37218822Sdim    {
38218822Sdim      lock_type lock;
39218822Sdim
40218822Sdim      VERIFY( !lock.owns_lock() );
41218822Sdim      VERIFY( !(bool)lock );
42218822Sdim    }
43218822Sdim  catch (const std::system_error& e)
44218822Sdim    {
45218822Sdim      VERIFY( false );
46218822Sdim    }
47218822Sdim  catch (...)
48218822Sdim    {
49218822Sdim      VERIFY( false );
50218822Sdim    }
51218822Sdim
52218822Sdim  return 0;
53218822Sdim}
54218822Sdim