150
|
1 //===------------------- uncaught_exceptions.pass.cpp ---------------------===//
|
|
2 //
|
|
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
|
|
6 //
|
|
7 //===----------------------------------------------------------------------===//
|
|
8
|
173
|
9 // UNSUPPORTED: no-exceptions
|
150
|
10
|
|
11 #include <cxxabi.h>
|
|
12 #include <cassert>
|
|
13
|
|
14 // namespace __cxxabiv1 {
|
|
15 // extern unsigned int __cxa_uncaught_exceptions() throw();
|
|
16 // }
|
|
17
|
|
18 struct A {
|
|
19 A(unsigned cnt) : data_(cnt) {}
|
|
20 ~A() { assert( data_ == __cxxabiv1::__cxa_uncaught_exceptions()); }
|
|
21 unsigned data_;
|
|
22 };
|
|
23
|
|
24 int main () {
|
|
25 try { A a(1); throw 3; assert(false); }
|
|
26 catch (int) {}
|
|
27 }
|