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-exception
6//
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_istream
22 : 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)) // OK
28 {
29 }
30
31 test_istream& operator=(test_istream&& s) {
32 base::operator=(rhs: std::move(s)); // OK
33 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

source code of libcxx/test/std/input.output/iostream.format/input.streams/istream/istream.cons/copy.verify.cpp