[DAG] TransformFPLoadStorePair - early out if we're not loading a simple type
[llvm-project.git] / libcxx / test / std / thread / futures / futures.task / futures.task.members / ctor_move.pass.cpp
blobeb80e749199e1fd5c8e032a49d92b9b36f62cb7b
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // UNSUPPORTED: no-threads
10 // UNSUPPORTED: c++03
12 // <future>
14 // class packaged_task<R(ArgTypes...)>
16 // packaged_task(packaged_task&& other);
18 #include <future>
19 #include <cassert>
21 #include "test_macros.h"
23 class A
25 long data_;
27 public:
28 explicit A(long i) : data_(i) {}
30 long operator()(long i, long j) const {return data_ + i + j;}
33 int main(int, char**)
36 std::packaged_task<double(int, char)> p0(A(5));
37 std::packaged_task<double(int, char)> p = std::move(p0);
38 assert(!p0.valid());
39 assert(p.valid());
40 std::future<double> f = p.get_future();
41 p(3, 97);
42 assert(f.get() == 105.0);
45 std::packaged_task<double(int, char)> p0;
46 std::packaged_task<double(int, char)> p = std::move(p0);
47 assert(!p0.valid());
48 assert(!p.valid());
51 return 0;