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 // void rethrow_exception [[noreturn]] (exception_ptr p);
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;
41 p
= std::current_exception();
45 std::rethrow_exception(p
);
50 #ifndef TEST_ABI_MICROSOFT
51 assert(A::constructed
== 1);
53 // On Windows the exception_ptr copies the exception
54 assert(A::constructed
== 2);
60 assert(A::constructed
== 1);
62 assert(A::constructed
== 0);
64 assert(A::constructed
== 0);