blob: 1cb61d9af297e0b843d27a017aab42cb6f04b43d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// UNSUPPORTED: libcpp-no-exceptions
// UNSUPPORTED: libcpp-has-no-threads
// UNSUPPORTED: c++98, c++03
// <future>
// class promise<R>
// void set_exception_on_thread_exit(exception_ptr p);
// Test that a null exception_ptr is diagnosed.
#define _LIBCPP_ASSERT(x, m) ((x) ? ((void)0) : throw 42)
#define _LIBCPP_DEBUG 0
#include <future>
#include <exception>
#include <cstdlib>
#include <cassert>
int main()
{
{
typedef int T;
std::promise<T> p;
try {
p.set_exception_at_thread_exit(std::exception_ptr());
assert(false);
} catch (int const& value) {
assert(value == 42);
}
}
{
typedef int& T;
std::promise<T> p;
try {
p.set_exception_at_thread_exit(std::exception_ptr());
assert(false);
} catch (int const& value) {
assert(value == 42);
}
}
}
|