blob: 5246ad8f644c441f12b78cf1a6fb9c42737e4f6d [file] [log] [blame]
Dan Albert287553d2017-02-16 10:47:51 -08001//===----------------------------------------------------------------------===//
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#include <ios>
17#include <string>
18#include <cassert>
19#include <cstdint>
20
21class test
22 : public std::ios
23{
24public:
25 test()
26 {
27 init(0);
28 }
29};
30
31int main()
32{
33 test t;
34 std::ios_base& b = t;
35 for (std::intptr_t i = 0; i < 10000; ++i)
36 {
37 assert(b.pword(i) == 0);
38 b.pword(i) = (void*)i;
39 assert(b.pword(i) == (void*)i);
40 for (std::intptr_t j = 0; j <= i; ++j)
41 assert(b.pword(j) == (void*)j);
42 }
43}