• 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 // class ios_base
13 
14 // void*& pword(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 #include <cstdint>
23 
24 class test
25     : public std::ios
26 {
27 public:
test()28     test()
29     {
30         init(0);
31     }
32 };
33 
main()34 int main()
35 {
36     test t;
37     std::ios_base& b = t;
38     for (std::intptr_t i = 0; i < 10000; ++i)
39     {
40         assert(b.pword(i) == 0);
41         b.pword(i) = (void*)i;
42         assert(b.pword(i) == (void*)i);
43         for (std::intptr_t j = 0; j <= i; ++j)
44             assert(b.pword(j) == (void*)j);
45     }
46 }
47