1*74fd3cb8SChristopher Di Bella //===----------------------------------------------------------------------===//
2*74fd3cb8SChristopher Di Bella //
3*74fd3cb8SChristopher Di Bella // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*74fd3cb8SChristopher Di Bella // See https://llvm.org/LICENSE.txt for license information.
5*74fd3cb8SChristopher Di Bella // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*74fd3cb8SChristopher Di Bella //
7*74fd3cb8SChristopher Di Bella //===----------------------------------------------------------------------===//
8*74fd3cb8SChristopher Di Bella
9*74fd3cb8SChristopher Di Bella // UNSUPPORTED: c++03, c++11, c++14, c++17
10*74fd3cb8SChristopher Di Bella
11*74fd3cb8SChristopher Di Bella // std::ranges::dangling;
12*74fd3cb8SChristopher Di Bella
13*74fd3cb8SChristopher Di Bella #include <ranges>
14*74fd3cb8SChristopher Di Bella
15*74fd3cb8SChristopher Di Bella #include <concepts>
16*74fd3cb8SChristopher Di Bella #include <type_traits>
17*74fd3cb8SChristopher Di Bella
18*74fd3cb8SChristopher Di Bella static_assert(std::is_empty_v<std::ranges::dangling>);
19*74fd3cb8SChristopher Di Bella
20*74fd3cb8SChristopher Di Bella template<int> struct S { };
21*74fd3cb8SChristopher Di Bella static_assert(std::is_nothrow_constructible_v<std::ranges::dangling>);
22*74fd3cb8SChristopher Di Bella static_assert(std::is_nothrow_constructible_v<std::ranges::dangling, S<0>>);
23*74fd3cb8SChristopher Di Bella static_assert(std::is_nothrow_constructible_v<std::ranges::dangling, S<0>, S<1>>);
24*74fd3cb8SChristopher Di Bella static_assert(std::is_nothrow_constructible_v<std::ranges::dangling, S<0>, S<1>, S<2>>);
25*74fd3cb8SChristopher Di Bella
test_dangling()26*74fd3cb8SChristopher Di Bella constexpr bool test_dangling() {
27*74fd3cb8SChristopher Di Bella [[maybe_unused]] auto a = std::ranges::dangling();
28*74fd3cb8SChristopher Di Bella [[maybe_unused]] auto b = std::ranges::dangling(S<0>());
29*74fd3cb8SChristopher Di Bella [[maybe_unused]] auto c = std::ranges::dangling(S<0>(), S<1>());
30*74fd3cb8SChristopher Di Bella [[maybe_unused]] auto d = std::ranges::dangling(S<0>(), S<1>(), S<2>());
31*74fd3cb8SChristopher Di Bella return true;
32*74fd3cb8SChristopher Di Bella }
33*74fd3cb8SChristopher Di Bella
main(int,char **)34*74fd3cb8SChristopher Di Bella int main(int, char**) {
35*74fd3cb8SChristopher Di Bella static_assert(test_dangling());
36*74fd3cb8SChristopher Di Bella test_dangling();
37*74fd3cb8SChristopher Di Bella return 0;
38*74fd3cb8SChristopher Di Bella }
39