brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 35d52c4 Raw
50 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// <ios>10 11// class ios_base12 13// void*& pword(int idx);14 15// This test compiles but never completes when compiled against the MSVC STL16// UNSUPPORTED: stdlib=msvc17 18#include <ios>19#include <string>20#include <cassert>21#include <cstdint>22 23#include "test_macros.h"24 25class test26    : public std::ios27{28public:29    test()30    {31        init(0);32    }33};34 35int main(int, char**)36{37    test t;38    std::ios_base& b = t;39    for (std::intptr_t i = 0; i < 10000; ++i)40    {41        assert(b.pword(i) == 0);42        b.pword(i) = (void*)i;43        assert(b.pword(i) == (void*)i);44        for (std::intptr_t j = 0; j <= i; ++j)45            assert(b.pword(j) == (void*)j);46    }47 48  return 0;49}50