32 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// test unexpected10 11// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS12 13#include <exception>14#include <cstdlib>15#include <cassert>16 17#include "test_macros.h"18 19void fexit()20{21 std::exit(0);22}23 24int main(int, char**)25{26 std::set_unexpected(fexit);27 std::unexpected();28 assert(false);29 30 return 0;31}32