| //===----------------------------------------------------------------------===// |
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| // See https://llvm.org/LICENSE.txt for license information. |
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| //===----------------------------------------------------------------------===// |
| // template <class charT, class traits> class basic_ios |
| // void clear(iostate state = goodbit); |
| struct testbuf : public std::streambuf {}; |
| assert(ios.rdstate() == std::ios::badbit); |
| #ifndef TEST_HAS_NO_EXCEPTIONS |
| ios.exceptions(std::ios::badbit); |
| catch (std::ios::failure&) |
| assert(ios.rdstate() == std::ios::badbit); |
| ios.clear(std::ios::eofbit); |
| catch (std::ios::failure&) |
| assert(ios.rdstate() == (std::ios::eofbit | std::ios::badbit)); |
| assert(ios.rdstate() == std::ios::goodbit); |
| ios.exceptions(std::ios::badbit); |
| assert(ios.rdstate() == std::ios::goodbit); |
| ios.clear(std::ios::eofbit); |
| assert(ios.rdstate() == std::ios::eofbit); |