libstdc++: Add C++2a synchronization support
[gcc.git] / libstdc++-v3 / testsuite / 29_atomics / atomic_integral / wait_notify.cc
1 // { dg-options "-std=gnu++2a -pthread" }
2 // { dg-do run { target c++2a } }
3 // { dg-require-effective-target pthread }
4 // { dg-require-gthreads "" }
5
6 // Copyright (C) 2020 Free Software Foundation, Inc.
7 //
8 // This file is part of the GNU ISO C++ Library. This library is free
9 // software; you can redistribute it and/or modify it under the
10 // terms of the GNU General Public License as published by the
11 // Free Software Foundation; either version 3, or (at your option)
12 // any later version.
13
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
18
19 // You should have received a copy of the GNU General Public License along
20 // with this library; see the file COPYING3. If not see
21 // <http://www.gnu.org/licenses/>.
22
23 #include "atomic/wait_notify_util.h"
24
25 void
26 test01()
27 {
28 struct S{ int i; };
29 std::atomic<S> s;
30
31 s.wait(S{42});
32 }
33
34 int
35 main ()
36 {
37 // check<bool> bb;
38 check<char> ch;
39 check<signed char> sch;
40 check<unsigned char> uch;
41 check<short> s;
42 check<unsigned short> us;
43 check<int> i;
44 check<unsigned int> ui;
45 check<long> l;
46 check<unsigned long> ul;
47 check<long long> ll;
48 check<unsigned long long> ull;
49
50 check<wchar_t> wch;
51 check<char8_t> ch8;
52 check<char16_t> ch16;
53 check<char32_t> ch32;
54
55 check<int8_t> i8;
56 check<int16_t> i16;
57 check<int32_t> i32;
58 check<int64_t> i64;
59
60 check<uint8_t> u8;
61 check<uint16_t> u16;
62 check<uint32_t> u32;
63 check<uint64_t> u64;
64 return 0;
65 }