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