| //===----------------------------------------------------------------------===// |
| // The LLVM Compiler Infrastructure |
| // This file is distributed under the University of Illinois Open Source |
| // License. See LICENSE.TXT for details. |
| //===----------------------------------------------------------------------===// |
| // template <class charT, class traits> class basic_ios |
| // void setstate(iostate state); |
| struct testbuf : public std::streambuf {}; |
| ios.setstate(std::ios::goodbit); |
| assert(ios.rdstate() == std::ios::badbit); |
| ios.exceptions(std::ios::badbit); |
| ios.setstate(std::ios::goodbit); |
| catch (std::ios::failure&) |
| assert(ios.rdstate() == std::ios::badbit); |
| ios.setstate(std::ios::eofbit); |
| catch (std::ios::failure&) |
| assert(ios.rdstate() == (std::ios::eofbit | std::ios::badbit)); |
| ios.setstate(std::ios::goodbit); |
| assert(ios.rdstate() == std::ios::goodbit); |
| ios.setstate(std::ios::eofbit); |
| assert(ios.rdstate() == std::ios::eofbit); |
| ios.setstate(std::ios::failbit); |
| assert(ios.rdstate() == (std::ios::eofbit | std::ios::failbit)); |