| //===----------------------------------------------------------------------===// |
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| // See https://llvm.org/LICENSE.txt for license information. |
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| //===----------------------------------------------------------------------===// |
| // UNSUPPORTED: libcpp-no-exceptions |
| // void rethrow_exception [[noreturn]] (exception_ptr p); |
| A(int data = 0) : data_(data) {++constructed;} |
| A(const A& a) : data_(a.data_) {++constructed;} |
| p = std::current_exception(); |
| std::rethrow_exception(p); |
| #ifndef _LIBCPP_ABI_MICROSOFT |
| assert(A::constructed == 1); |
| // On Windows the exception_ptr copies the exception |
| assert(A::constructed == 2); |
| assert(A::constructed == 1); |
| assert(A::constructed == 0); |
| assert(A::constructed == 0); |