//===----------------------------------------------------------------------===// // // 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 // SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. // //===----------------------------------------------------------------------===// // UNSUPPORTED: msvc-19.16 // class cuda::std::ranges::subrange; #include #include #include "test_iterators.h" #include "test_macros.h" #if TEST_STD_VER > 2017 template concept ValidSubrangeKind = requires { typename cuda::std::ranges::subrange; }; template concept ValidSubrange = requires { typename cuda::std::ranges::subrange; }; #else // clang is really not helpful here failing with concept emulation template constexpr bool ValidSubrange1 = false; template constexpr bool ValidSubrange1>> = true; template constexpr bool ValidSubrange2 = false; template constexpr bool ValidSubrange2>> = true; template constexpr bool ValidSubrange = false; template constexpr bool ValidSubrange = ValidSubrange1; template constexpr bool ValidSubrange = ValidSubrange2; template constexpr bool ValidSubrangeKind = false; template constexpr bool ValidSubrangeKind>> = true; #endif static_assert(ValidSubrange>); static_assert(ValidSubrange, forward_iterator>); static_assert( ValidSubrangeKind, forward_iterator>); static_assert( ValidSubrangeKind, forward_iterator>); // Wrong sentinel type. static_assert(!ValidSubrange, int*>); static_assert(ValidSubrange); static_assert(ValidSubrange); // Must be sized. static_assert(!ValidSubrangeKind); static_assert(ValidSubrangeKind); // Wrong sentinel type. static_assert(!ValidSubrange>); // Not an iterator. static_assert(!ValidSubrange); int main(int, char**) { return 0; }