annotate libstdc++-v3/testsuite/30_threads/promise/cons/move_assign.cc @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // { dg-do run }
kono
parents:
diff changeset
2 // { dg-options "-pthread" }
kono
parents:
diff changeset
3 // { dg-require-effective-target c++11 }
kono
parents:
diff changeset
4 // { dg-require-effective-target pthread }
kono
parents:
diff changeset
5 // { dg-require-gthreads "" }
kono
parents:
diff changeset
6
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
7 // Copyright (C) 2009-2018 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
8 //
kono
parents:
diff changeset
9 // This file is part of the GNU ISO C++ Library. This library is free
kono
parents:
diff changeset
10 // software; you can redistribute it and/or modify it under the
kono
parents:
diff changeset
11 // terms of the GNU General Public License as published by the
kono
parents:
diff changeset
12 // Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
13 // any later version.
kono
parents:
diff changeset
14
kono
parents:
diff changeset
15 // This library is distributed in the hope that it will be useful,
kono
parents:
diff changeset
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
kono
parents:
diff changeset
18 // GNU General Public License for more details.
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 // You should have received a copy of the GNU General Public License along
kono
parents:
diff changeset
21 // with this library; see the file COPYING3. If not see
kono
parents:
diff changeset
22 // <http://www.gnu.org/licenses/>.
kono
parents:
diff changeset
23
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 #include <future>
kono
parents:
diff changeset
26 #include <testsuite_hooks.h>
kono
parents:
diff changeset
27
kono
parents:
diff changeset
28 void test01()
kono
parents:
diff changeset
29 {
kono
parents:
diff changeset
30 using namespace std;
kono
parents:
diff changeset
31
kono
parents:
diff changeset
32 // move assign
kono
parents:
diff changeset
33 promise<int> p1;
kono
parents:
diff changeset
34 p1.set_value(3);
kono
parents:
diff changeset
35 promise<int> p2;
kono
parents:
diff changeset
36 p2 = move(p1);
kono
parents:
diff changeset
37 VERIFY( p2.get_future().get() == 3 );
kono
parents:
diff changeset
38 try
kono
parents:
diff changeset
39 {
kono
parents:
diff changeset
40 p1.get_future();
kono
parents:
diff changeset
41 VERIFY( false );
kono
parents:
diff changeset
42 }
kono
parents:
diff changeset
43 catch (future_error& e)
kono
parents:
diff changeset
44 {
kono
parents:
diff changeset
45 VERIFY(e.code() == make_error_code(future_errc::no_state));
kono
parents:
diff changeset
46 }
kono
parents:
diff changeset
47 }
kono
parents:
diff changeset
48
kono
parents:
diff changeset
49 int main()
kono
parents:
diff changeset
50 {
kono
parents:
diff changeset
51 test01();
kono
parents:
diff changeset
52 return 0;
kono
parents:
diff changeset
53 }