xref: /llvm-project/libcxx/test/support/test.support/test_macros_header.no_exceptions.verify.cpp (revision 72f0edf3f4291d2614719a8c8af21a7a62ed5d74)
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 // Make sure the TEST_HAS_NO_EXCEPTIONS macro is defined when exceptions are
10 // disabled.
11 
12 // REQUIRES: no-exceptions
13 
14 #include "test_macros.h"
15 
16 #ifndef TEST_HAS_NO_EXCEPTIONS
17 #  error "TEST_HAS_NO_EXCEPTIONS should be defined"
18 #endif
19 
f()20 void f() {
21     try { (void)0; } catch (...) { } // expected-error {{exceptions disabled}}
22 }
23