Home | History | Annotate | Download | only in ios.base.storage
      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 // class ios_base
     13 
     14 // long& iword(int idx);
     15 
     16 // This test compiles but never completes when compiled against the MSVC STL
     17 // UNSUPPORTED: msvc
     18 
     19 #include <ios>
     20 #include <string>
     21 #include <cassert>
     22 
     23 class test
     24     : public std::ios
     25 {
     26 public:
     27     test()
     28     {
     29         init(0);
     30     }
     31 };
     32 
     33 int main()
     34 {
     35     test t;
     36     std::ios_base& b = t;
     37     for (int i = 0; i < 10000; ++i)
     38     {
     39         assert(b.iword(i) == 0);
     40         b.iword(i) = i;
     41         assert(b.iword(i) == i);
     42         for (int j = 0; j <= i; ++j)
     43             assert(b.iword(j) == j);
     44     }
     45 }
     46