brintos

brintos / llvm-project-archived public Read only

0
0
Text · 986 B · 44f94ee Raw
49 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// long& iword(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 22#include "test_macros.h"23 24class test25    : public std::ios26{27public:28    test()29    {30        init(0);31    }32};33 34int main(int, char**)35{36    test t;37    std::ios_base& b = t;38    for (int i = 0; i < 10000; ++i)39    {40        assert(b.iword(i) == 0);41        b.iword(i) = i;42        assert(b.iword(i) == i);43        for (int j = 0; j <= i; ++j)44            assert(b.iword(j) == j);45    }46 47  return 0;48}49