brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 8f0f5a6 Raw
44 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// <ios>10 11// template <class charT, class traits> class basic_ios12 13// void clear(iostate state);14 15// Make sure that we abort() when exceptions are disabled and the exception16// flag is set for the iostate we pass to clear().17 18// REQUIRES: no-exceptions19 20#include <csignal>21#include <cstdlib>22#include <ios>23#include <streambuf>24 25#include "test_macros.h"26 27 28void exit_success(int) {29    std::_Exit(EXIT_SUCCESS);30}31 32struct testbuf : public std::streambuf {};33 34int main(int, char**) {35    std::signal(SIGABRT, exit_success);36 37    testbuf buf;38    std::ios ios(&buf);39    ios.exceptions(std::ios::badbit);40    ios.clear(std::ios::badbit);41 42    return EXIT_FAILURE;43}44