1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <iomanip> 11 12 // T2 setiosflags (ios_base::fmtflags mask); 13 14 #include <iomanip> 15 #include <istream> 16 #include <ostream> 17 #include <cassert> 18 19 template <class CharT> 20 struct testbuf 21 : public std::basic_streambuf<CharT> 22 { testbuftestbuf23 testbuf() {} 24 }; 25 main()26int main() 27 { 28 { 29 testbuf<char> sb; 30 std::istream is(&sb); 31 assert(!(is.flags() & std::ios_base::oct)); 32 is >> std::setiosflags(std::ios_base::oct); 33 assert(is.flags() & std::ios_base::oct); 34 } 35 { 36 testbuf<char> sb; 37 std::ostream os(&sb); 38 assert(!(os.flags() & std::ios_base::oct)); 39 os << std::setiosflags(std::ios_base::oct); 40 assert(os.flags() & std::ios_base::oct); 41 } 42 { 43 testbuf<wchar_t> sb; 44 std::wistream is(&sb); 45 assert(!(is.flags() & std::ios_base::oct)); 46 is >> std::setiosflags(std::ios_base::oct); 47 assert(is.flags() & std::ios_base::oct); 48 } 49 { 50 testbuf<wchar_t> sb; 51 std::wostream os(&sb); 52 assert(!(os.flags() & std::ios_base::oct)); 53 os << std::setiosflags(std::ios_base::oct); 54 assert(os.flags() & std::ios_base::oct); 55 } 56 } 57