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 // UNSUPPORTED: c++03, c++11, c++14, c++17
10 // UNSUPPORTED: libcpp-no-concepts
11 // UNSUPPORTED: gcc-11
12 // UNSUPPORTED: libcpp-has-no-incomplete-ranges
13 
14 // Tests that <value_> is a <copyable-box>.
15 
16 #include <cassert>
17 #include <ranges>
18 #include <utility>
19 
20 #include "test_macros.h"
21 
22 struct NotAssignable {
23   NotAssignable() = default;
24   NotAssignable(const NotAssignable&) = default;
25   NotAssignable(NotAssignable&&) = default;
26 
27   NotAssignable& operator=(const NotAssignable&) = delete;
28   NotAssignable& operator=(NotAssignable&&) = delete;
29 };
30 
31 constexpr bool test() {
32   const std::ranges::single_view<NotAssignable> a;
33   std::ranges::single_view<NotAssignable> b;
34   b = a;
35   b = std::move(a);
36 
37   return true;
38 }
39 
40 int main(int, char**) {
41   test();
42   static_assert(test());
43 
44   return 0;
45 }
46