[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / thread / futures / futures.promise / set_exception_at_thread_exit.pass.cpp
bloba1a351ec02b0418c45f20fdacbfc9580cd93e168
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-exceptions
10 // UNSUPPORTED: no-threads
11 // UNSUPPORTED: c++03
13 // <future>
15 // class promise<R>
17 // void promise::set_exception_at_thread_exit(exception_ptr p);
19 #include <future>
20 #include <cassert>
22 #include "make_test_thread.h"
23 #include "test_macros.h"
25 void func(std::promise<int> p)
27 p.set_exception_at_thread_exit(std::make_exception_ptr(3));
30 int main(int, char**)
33 typedef int T;
34 std::promise<T> p;
35 std::future<T> f = p.get_future();
36 support::make_test_thread(func, std::move(p)).detach();
37 try
39 f.get();
40 assert(false);
42 catch (int i)
44 assert(i == 3);
48 return 0;