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 11 // constexpr V base() const& requires copy_constructible<V> { return base_; } 12 // constexpr V base() && { return std::move(base_); } 13 14 #include <ranges> 15 16 #include "test_macros.h" 17 #include "types.h" 18 test()19constexpr bool test() { 20 std::ranges::drop_view<MoveOnlyView> dropView1; 21 auto base1 = std::move(dropView1).base(); 22 assert(std::ranges::begin(base1) == globalBuff); 23 24 // Note: we should *not* drop two elements here. 25 std::ranges::drop_view<MoveOnlyView> dropView2(MoveOnlyView{4}, 2); 26 auto base2 = std::move(dropView2).base(); 27 assert(std::ranges::begin(base2) == globalBuff + 4); 28 29 std::ranges::drop_view<CopyableView> dropView3; 30 auto base3 = dropView3.base(); 31 assert(std::ranges::begin(base3) == globalBuff); 32 auto base4 = std::move(dropView3).base(); 33 assert(std::ranges::begin(base4) == globalBuff); 34 35 return true; 36 } 37 main(int,char **)38int main(int, char**) { 39 test(); 40 static_assert(test()); 41 42 return 0; 43 } 44