1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-exceptions
11 // std::uncaught_exceptions() was introduced in the dylib on Mac OS 10.12
12 // XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{9|10|11}}
14 // However, std::uncaught_exceptions() gives the wrong answer in Mac OS 10.12
15 // and 10.13, where it only gives 0 or 1. This was fixed later.
16 // XFAIL: stdlib=apple-libc++ && target={{.+}}-apple-macosx10.{{12|13}}
18 // test uncaught_exceptions
23 #include "test_macros.h"
26 Uncaught(int depth
) : d_(depth
) {}
27 ~Uncaught() { assert(std::uncaught_exceptions() == d_
); }
32 Outer(int depth
) : d_(depth
) {}
35 assert(std::uncaught_exceptions() == d_
);
44 int main(int, char**) {
45 assert(std::uncaught_exceptions() == 0);
50 assert(std::uncaught_exceptions() == 0);
57 assert(std::uncaught_exceptions() == 0);
60 assert(std::uncaught_exceptions() == 0);