blob: 6a04c7179512279f856e09475b3ada8b391e4d4b [file] [log] [blame]
Louis Dionne549048f2019-04-18 17:18:15 +00001//===------------------- 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
Louis Dionne8c611142020-04-17 10:29:15 -04009// UNSUPPORTED: no-exceptions
Louis Dionne549048f2019-04-18 17:18:15 +000010
11// This tests that libc++abi still provides __cxa_uncaught_exception() for
12// ABI compatibility, even though the Standard doesn't require it to.
Louis Dionne549048f2019-04-18 17:18:15 +000013
14#include <cxxabi.h>
15#include <cassert>
16
17// namespace __cxxabiv1 {
18// extern bool __cxa_uncaught_exception () throw();
19// }
20
21struct A {
22 ~A() { assert( __cxxabiv1::__cxa_uncaught_exception()); }
23};
24
25int main () {
26 try { A a; throw 3; assert(false); }
27 catch (int) {}
28}