| 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 | // <ranges> |
| 12 | |
| 13 | // template<class T> |
| 14 | // concept view = ...; |
| 15 | |
| 16 | #include <ranges> |
| 17 | |
| 18 | #include "test_macros.h" |
| 19 | |
| 20 | struct View : std::ranges::view_base { |
| 21 | View() = default; |
| 22 | View(View&&) = default; |
| 23 | View& operator=(View&&) = default; |
| 24 | friend int* begin(View&); |
| 25 | friend int* begin(View const&); |
| 26 | friend int* end(View&); |
| 27 | friend int* end(View const&); |
| 28 | }; |
| 29 | |
| 30 | namespace subsume_range { |
| 31 | template <std::ranges::view> |
| 32 | constexpr bool test() { return true; } |
| 33 | template <std::ranges::range> |
| 34 | constexpr bool test() { return false; } |
| 35 | static_assert(test<View>()); |
| 36 | } |
| 37 | |
| 38 | namespace subsume_movable { |
| 39 | template <std::ranges::view> |
| 40 | constexpr bool test() { return true; } |
| 41 | template <std::movable> |
| 42 | constexpr bool test() { return false; } |
| 43 | static_assert(test<View>()); |
| 44 | } |
| 45 | |