[AMDGPU] Mark AGPR tuple implicit in the first instr of AGPR spills. (#115285)
[llvm-project.git] / libcxx / test / std / thread / futures / futures.unique_future / share.pass.cpp
blob4cc8e26030d0a2d9ca3b9e9bc5204dda765b0cd2
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 future<R>
16 // shared_future<R> share() &&;
18 #include <future>
19 #include <cassert>
21 #include "test_macros.h"
23 int main(int, char**)
26 typedef int T;
27 std::promise<T> p;
28 std::future<T> f0 = p.get_future();
29 static_assert( noexcept(f0.share()), "");
30 std::shared_future<T> f = f0.share();
31 assert(!f0.valid());
32 assert(f.valid());
35 typedef int T;
36 std::future<T> f0;
37 static_assert( noexcept(f0.share()), "");
38 std::shared_future<T> f = f0.share();
39 assert(!f0.valid());
40 assert(!f.valid());
43 typedef int& T;
44 std::promise<T> p;
45 std::future<T> f0 = p.get_future();
46 static_assert( noexcept(f0.share()), "");
47 std::shared_future<T> f = f0.share();
48 assert(!f0.valid());
49 assert(f.valid());
52 typedef int& T;
53 std::future<T> f0;
54 static_assert( noexcept(f0.share()), "");
55 std::shared_future<T> f = f0.share();
56 assert(!f0.valid());
57 assert(!f.valid());
60 typedef void T;
61 std::promise<T> p;
62 std::future<T> f0 = p.get_future();
63 static_assert( noexcept(f0.share()), "");
64 std::shared_future<T> f = f0.share();
65 assert(!f0.valid());
66 assert(f.valid());
69 typedef void T;
70 std::future<T> f0;
71 static_assert( noexcept(f0.share()), "");
72 std::shared_future<T> f = f0.share();
73 assert(!f0.valid());
74 assert(!f.valid());
77 return 0;