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