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 <ranges>
17 #include <cassert>
18 
19 #include "test_macros.h"
20 
21 struct NotAssignable {
22   NotAssignable() = default;
23   NotAssignable(const NotAssignable&) = default;
24   NotAssignable(NotAssignable&&) = default;
25 
26   NotAssignable& operator=(const NotAssignable&) = delete;
27   NotAssignable& operator=(NotAssignable&&) = delete;
28 };
29 
test()30 constexpr bool test() {
31   const std::ranges::single_view<NotAssignable> a;
32   std::ranges::single_view<NotAssignable> b;
33   b = a;
34   b = std::move(a);
35 
36   return true;
37 }
38 
main(int,char **)39 int main(int, char**) {
40   test();
41   static_assert(test());
42 
43   return 0;
44 }
45