[PR c++/84492] stmt expr ending with overload
[official-gcc.git] / libstdc++-v3 / testsuite / 30_threads / async / launch.cc
blobf2b1f97e45af803f22b999bc682466c7a74b3b85
1 // { dg-do run }
2 // { dg-options "-pthread" }
3 // { dg-require-effective-target c++11 }
4 // { dg-require-effective-target pthread }
5 // { dg-require-cstdint "" }
6 // { dg-require-gthreads "" }
8 // Copyright (C) 2011-2018 Free Software Foundation, Inc.
9 //
10 // This file is part of the GNU ISO C++ Library. This library is free
11 // software; you can redistribute it and/or modify it under the
12 // terms of the GNU General Public License as published by the
13 // Free Software Foundation; either version 3, or (at your option)
14 // any later version.
16 // This library is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
21 // You should have received a copy of the GNU General Public License along
22 // with this library; see the file COPYING3. If not see
23 // <http://www.gnu.org/licenses/>.
26 #include <future>
27 #include <testsuite_hooks.h>
29 void test01()
31 using std::launch;
33 const launch none{};
34 const launch both = launch::async|launch::deferred;
35 const launch all = ~none;
37 VERIFY( (none & both) == none );
38 VERIFY( (none | both) == both );
39 VERIFY( (none ^ both) == both );
41 VERIFY( (none & all) == none );
42 VERIFY( (none | all) == all );
43 VERIFY( (none ^ all) == all );
45 VERIFY( (both & all) == both );
46 VERIFY( (both | all) == all );
47 VERIFY( (both ^ all) == ~both );
49 VERIFY( (none & launch::async) == none );
50 VERIFY( (none & launch::deferred) == none );
52 VERIFY( (none | launch::async) == launch::async );
53 VERIFY( (none | launch::deferred) == launch::deferred );
55 VERIFY( (none ^ launch::async) == launch::async );
56 VERIFY( (none ^ launch::deferred) == launch::deferred );
58 VERIFY( (none & none) == none );
59 VERIFY( (none | none) == none );
60 VERIFY( (none ^ none) == none );
62 VERIFY( (both & both) == both );
63 VERIFY( (both | both) == both );
64 VERIFY( (both ^ both) == none );
66 VERIFY( (all & all) == all );
67 VERIFY( (all | all) == all );
68 VERIFY( (all ^ all) == none );
70 launch l = none;
72 l &= none;
73 VERIFY( l == none );
74 l |= none;
75 VERIFY( l == none );
76 l ^= none;
77 VERIFY( l == none );
79 l &= both;
80 VERIFY( l == none );
81 l |= both;
82 VERIFY( l == both );
83 l ^= both;
84 VERIFY( l == none );
87 int main()
89 test01();
90 return 0;