brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 90e5315 Raw
52 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// <istream>10 11// template <class charT, class traits = char_traits<charT> >12// class basic_istream;13 14// basic_istream(basic_istream const& rhs) = delete;15// basic_istream& operator=(basic_istream const&) = delete;16 17#include <istream>18#include <type_traits>19#include <cassert>20 21struct test_istream22    : public std::basic_istream<char>23{24    typedef std::basic_istream<char> base;25 26    test_istream(test_istream&& s)27        : base(std::move(s)) // OK28    {29    }30 31    test_istream& operator=(test_istream&& s) {32      base::operator=(std::move(s)); // OK33      return *this;34    }35 36    test_istream(test_istream const& s)37        : base(s) // expected-error {{call to deleted constructor of 'std::basic_istream<char>'}}38    {39    }40 41    test_istream& operator=(test_istream const& s) {42      base::operator=(s); // expected-error {{call to deleted member function 'operator='}}43      return *this;44    }45 46};47 48int main(int, char**)49{50  return 0;51}52