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 // UNSUPPORTED: libcpp-has-no-incomplete-ranges 11 12 // std::ranges::dangling; 13 14 #include <ranges> 15 16 #include <concepts> 17 #include <type_traits> 18 19 static_assert(std::is_empty_v<std::ranges::dangling>); 20 21 template<int> struct S { }; 22 static_assert(std::is_nothrow_constructible_v<std::ranges::dangling>); 23 static_assert(std::is_nothrow_constructible_v<std::ranges::dangling, S<0>>); 24 static_assert(std::is_nothrow_constructible_v<std::ranges::dangling, S<0>, S<1>>); 25 static_assert(std::is_nothrow_constructible_v<std::ranges::dangling, S<0>, S<1>, S<2>>); 26 27 constexpr bool test_dangling() { 28 [[maybe_unused]] auto a = std::ranges::dangling(); 29 [[maybe_unused]] auto b = std::ranges::dangling(S<0>()); 30 [[maybe_unused]] auto c = std::ranges::dangling(S<0>(), S<1>()); 31 [[maybe_unused]] auto d = std::ranges::dangling(S<0>(), S<1>(), S<2>()); 32 return true; 33 } 34 35 int main(int, char**) { 36 static_assert(test_dangling()); 37 test_dangling(); 38 return 0; 39 } 40