30 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 terminate10 11#include <exception>12#include <cstdlib>13#include <cassert>14 15#include "test_macros.h"16 17void f1()18{19 std::exit(0);20}21 22int main(int, char**)23{24 std::set_terminate(f1);25 std::terminate();26 assert(false);27 28 return 0;29}30