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 // This test ensures that assertions trigger without the user having to do anything when the fast hardening mode has 10 // been enabled by default. 11 12 // REQUIRES: libcpp-hardening-mode=fast 13 // `check_assertion.h` is only available starting from C++11. 14 // UNSUPPORTED: c++03 15 // `check_assertion.h` requires Unix headers. 16 // REQUIRES: has-unix-headers 17 18 #include <cassert> 19 #include "check_assertion.h" 20 main(int,char **)21int main(int, char**) { 22 _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(true, "Should not fire"); 23 TEST_LIBCPP_ASSERT_FAILURE([] { _LIBCPP_ASSERT_VALID_ELEMENT_ACCESS(false, "Should fire"); }(), "Should fire"); 24 25 return 0; 26 } 27