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-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // <iomanip> 10 11 // T2 setiosflags (ios_base::fmtflags mask); 12 13 #include <iomanip> 14 #include <istream> 15 #include <ostream> 16 #include <cassert> 17 18 #include "test_macros.h" 19 20 template <class CharT> 21 struct testbuf 22 : public std::basic_streambuf<CharT> 23 { testbuftestbuf24 testbuf() {} 25 }; 26 main(int,char **)27int main(int, char**) 28 { 29 { 30 testbuf<char> sb; 31 std::istream is(&sb); 32 assert(!(is.flags() & std::ios_base::oct)); 33 is >> std::setiosflags(std::ios_base::oct); 34 assert(is.flags() & std::ios_base::oct); 35 } 36 { 37 testbuf<char> sb; 38 std::ostream os(&sb); 39 assert(!(os.flags() & std::ios_base::oct)); 40 os << std::setiosflags(std::ios_base::oct); 41 assert(os.flags() & std::ios_base::oct); 42 } 43 { 44 testbuf<wchar_t> sb; 45 std::wistream is(&sb); 46 assert(!(is.flags() & std::ios_base::oct)); 47 is >> std::setiosflags(std::ios_base::oct); 48 assert(is.flags() & std::ios_base::oct); 49 } 50 { 51 testbuf<wchar_t> sb; 52 std::wostream os(&sb); 53 assert(!(os.flags() & std::ios_base::oct)); 54 os << std::setiosflags(std::ios_base::oct); 55 assert(os.flags() & std::ios_base::oct); 56 } 57 58 return 0; 59 } 60