• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // <ios>
11 
12 // template <class charT, class traits> class basic_ios
13 
14 // operator unspecified-bool-type() const;
15 
16 #include <ios>
17 #include <type_traits>
18 #include <cassert>
19 
20 #include "test_macros.h"
21 
main()22 int main()
23 {
24     std::ios ios(0);
25     assert(static_cast<bool>(ios) == !ios.fail());
26     ios.setstate(std::ios::failbit);
27     assert(static_cast<bool>(ios) == !ios.fail());
28     static_assert((!std::is_convertible<std::ios, void*>::value), "");
29     static_assert((!std::is_convertible<std::ios, int>::value), "");
30     static_assert((!std::is_convertible<std::ios const&, int>::value), "");
31 #if TEST_STD_VER >= 11
32     static_assert((!std::is_convertible<std::ios, bool>::value), "");
33 #endif
34 }
35