1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-exceptions
12 // template<class E> exception_ptr make_exception_ptr(E e);
17 #include "test_macros.h"
21 static int constructed
;
24 A(int data
= 0) : data_(data
) {++constructed
;}
26 A(const A
& a
) : data_(a
.data_
) {++constructed
;}
29 int A::constructed
= 0;
34 std::exception_ptr p
= std::make_exception_ptr(A(5));
37 std::rethrow_exception(p
);
42 #ifndef TEST_ABI_MICROSOFT
43 assert(A::constructed
== 1);
45 // On Windows exception_ptr copies the exception
46 assert(A::constructed
== 2);
52 assert(A::constructed
== 1);
54 assert(A::constructed
== 0);
56 assert(A::constructed
== 0);