1*eb8650a7SLouis Dionne //===----------------------------------------------------------------------===// 2604de5c2SMarshall Clow // 357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6604de5c2SMarshall Clow // 7604de5c2SMarshall Clow //===----------------------------------------------------------------------===// 8604de5c2SMarshall Clow 98c61114cSLouis Dionne // UNSUPPORTED: no-exceptions 1057e446daSAsiri Rathnayake 1160ba1fefSLouis Dionne // __cxa_uncaught_exceptions is not re-exported from libc++ until macOS 10.15. 12c360553cSLouis Dionne // XFAIL: use_system_cxx_lib && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}} 1360ba1fefSLouis Dionne 14604de5c2SMarshall Clow #include <cxxabi.h> 15604de5c2SMarshall Clow #include <cassert> 16604de5c2SMarshall Clow 17604de5c2SMarshall Clow // namespace __cxxabiv1 { 18604de5c2SMarshall Clow // extern unsigned int __cxa_uncaught_exceptions() throw(); 19604de5c2SMarshall Clow // } 20604de5c2SMarshall Clow 21604de5c2SMarshall Clow struct A { AA22549048f3SLouis Dionne A(unsigned cnt) : data_(cnt) {} ~AA23549048f3SLouis Dionne ~A() { assert( data_ == __cxxabiv1::__cxa_uncaught_exceptions()); } 242f179bd8SEric Fiselier unsigned data_; 25604de5c2SMarshall Clow }; 26604de5c2SMarshall Clow main()27549048f3SLouis Dionneint main () { 28549048f3SLouis Dionne try { A a(1); throw 3; assert(false); } 29604de5c2SMarshall Clow catch (int) {} 30604de5c2SMarshall Clow } 31