1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
11 // constexpr T* end() noexcept;
12 // constexpr const T* end() const noexcept;
17 #include "test_macros.h"
20 struct BigType
{ char buffer
[64] = {10}; };
22 constexpr bool test() {
24 auto sv
= std::ranges::single_view
<int>(42);
25 assert(sv
.end() == sv
.begin() + 1);
27 ASSERT_SAME_TYPE(decltype(sv
.end()), int*);
28 static_assert(noexcept(sv
.end()));
31 const auto sv
= std::ranges::single_view
<int>(42);
32 assert(sv
.end() == sv
.begin() + 1);
34 ASSERT_SAME_TYPE(decltype(sv
.end()), const int*);
35 static_assert(noexcept(sv
.end()));
39 auto sv
= std::ranges::single_view
<Empty
>(Empty());
40 assert(sv
.end() == sv
.begin() + 1);
42 ASSERT_SAME_TYPE(decltype(sv
.end()), Empty
*);
45 const auto sv
= std::ranges::single_view
<Empty
>(Empty());
46 assert(sv
.end() == sv
.begin() + 1);
48 ASSERT_SAME_TYPE(decltype(sv
.end()), const Empty
*);
52 auto sv
= std::ranges::single_view
<BigType
>(BigType());
53 assert(sv
.end() == sv
.begin() + 1);
55 ASSERT_SAME_TYPE(decltype(sv
.end()), BigType
*);
58 const auto sv
= std::ranges::single_view
<BigType
>(BigType());
59 assert(sv
.end() == sv
.begin() + 1);
61 ASSERT_SAME_TYPE(decltype(sv
.end()), const BigType
*);
67 int main(int, char**) {
69 static_assert(test());