1//===----------------------------------------------------------------------===//
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
9// TODO(mordante) Investigate
10// UNSUPPORTED: apple-clang
11
12// UNSUPPORTED: no-exceptions
13
14// This tests that libc++abi still provides __cxa_uncaught_exception() for
15// ABI compatibility, even though the Standard doesn't require it to.
16
17// __cxa_uncaught_exception was not re-exported from libc++ previously. This leads
18// to undefined symbols when linking against a libc++ that re-exports the symbols,
19// but running against a libc++ that doesn't. Fortunately, usage of __cxa_uncaught_exception()
20// in the wild seems to be close to non-existent.
21// XFAIL: using-built-library-before-llvm-19
22
23#include <cxxabi.h>
24#include <cassert>
25
26// namespace __cxxabiv1 {
27// extern bool __cxa_uncaught_exception () throw();
28// }
29
30struct A {
31 ~A() { assert( __cxxabiv1::__cxa_uncaught_exception()); }
32};
33
34int main () {
35 try { A a; throw 3; assert(false); }
36 catch (int) {}
37}
38

Provided by KDAB

Privacy Policy
Improve your Profiling and Debugging skills
Find out more

source code of libcxxabi/test/uncaught_exception.pass.cpp