[RISCV] Fix mgather -> riscv.masked.strided.load combine not extending indices (...
[llvm-project.git] / libcxx / test / std / thread / futures / futures.promise / set_exception.pass.cpp
blobbc6bc26dbbb01e7fe3df0e66ac9fc1a4f45ad757
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 set_exception(exception_ptr p);
19 #include <future>
20 #include <cassert>
22 #include "test_macros.h"
24 int main(int, char**)
27 typedef int T;
28 std::promise<T> p;
29 std::future<T> f = p.get_future();
30 p.set_exception(std::make_exception_ptr(3));
31 try
33 f.get();
34 assert(false);
36 catch (int i)
38 assert(i == 3);
40 try
42 p.set_exception(std::make_exception_ptr(3));
43 assert(false);
45 catch (const std::future_error& e)
47 assert(e.code() == make_error_code(std::future_errc::promise_already_satisfied));
51 return 0;