Clang] Fix expansion of response files in -Wp after integrated-cc1 change
[llvm-project.git] / libcxxabi / test / noexception1.pass.cpp
blobb3471dd23fe98dc17a8822e2ab5631a10683b019
1 //===----------------------- noexception1.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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++98, c++03
10 // REQUIRES: libcxxabi-no-exceptions
12 #include <cxxabi.h>
13 #include <exception>
14 #include <cassert>
15 #include <stdlib.h>
17 // namespace __cxxabiv1 {
18 // void __cxa_increment_exception_refcount(void *thrown_object) throw();
19 // }
21 unsigned gCounter = 0;
23 void my_terminate() { exit(0); }
25 int main ()
27 // should not call std::terminate()
28 __cxxabiv1::__cxa_increment_exception_refcount(nullptr);
30 std::set_terminate(my_terminate);
32 // should call std::terminate()
33 __cxxabiv1::__cxa_increment_exception_refcount((void*) &gCounter);
34 assert(false);
36 return 0;