2021-11-18 05:25:01 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2015-06-02 21:03:17 +08:00
|
|
|
//
|
2019-01-19 18:56:40 +08:00
|
|
|
// 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
|
2015-06-02 21:03:17 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2020-04-17 22:29:15 +08:00
|
|
|
// UNSUPPORTED: no-exceptions
|
2016-05-31 20:01:32 +08:00
|
|
|
|
2020-07-09 04:38:54 +08:00
|
|
|
// __cxa_uncaught_exceptions is not re-exported from libc++ until macOS 10.15.
|
2021-06-19 01:33:14 +08:00
|
|
|
// XFAIL: use_system_cxx_lib && target={{.+}}-apple-macosx10.{{9|10|11|12|13|14}}
|
2020-07-09 04:38:54 +08:00
|
|
|
|
2015-06-02 21:03:17 +08:00
|
|
|
#include <cxxabi.h>
|
|
|
|
#include <cassert>
|
|
|
|
|
|
|
|
// namespace __cxxabiv1 {
|
2019-04-19 01:18:15 +08:00
|
|
|
// extern unsigned int __cxa_uncaught_exceptions() throw();
|
2015-06-02 21:03:17 +08:00
|
|
|
// }
|
|
|
|
|
|
|
|
struct A {
|
2019-04-19 01:18:15 +08:00
|
|
|
A(unsigned cnt) : data_(cnt) {}
|
|
|
|
~A() { assert( data_ == __cxxabiv1::__cxa_uncaught_exceptions()); }
|
2016-12-11 13:43:20 +08:00
|
|
|
unsigned data_;
|
2019-04-19 01:18:15 +08:00
|
|
|
};
|
2015-06-02 21:03:17 +08:00
|
|
|
|
2019-04-19 01:18:15 +08:00
|
|
|
int main () {
|
|
|
|
try { A a(1); throw 3; assert(false); }
|
2015-06-02 21:03:17 +08:00
|
|
|
catch (int) {}
|
|
|
|
}
|