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