//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17 // constexpr iterator_t base() const; #include #include #include "../types.h" struct Iter : ForwardIterBase { int i; constexpr Iter() = default; constexpr Iter(int ii) : i(ii) {} }; constexpr bool test() { // base only has one const overload using SplitView = std::ranges::split_view, std::ranges::subrange>; using SplitIter = std::ranges::iterator_t; // const & { SplitView sv; const SplitIter it{sv, Iter{5}, {}}; std::same_as decltype(auto) base = it.base(); assert(base.i == 5); } // & { SplitView sv; SplitIter it{sv, Iter{5}, {}}; std::same_as decltype(auto) base = it.base(); assert(base.i == 5); } // && { SplitView sv; SplitIter it{sv, Iter{5}, {}}; std::same_as decltype(auto) base = std::move(it).base(); assert(base.i == 5); } // const && { SplitView sv; const SplitIter it{sv, Iter{5}, {}}; std::same_as decltype(auto) base = std::move(it).base(); assert(base.i == 5); } return true; } int main(int, char**) { test(); static_assert(test()); return 0; }