// PR c++/114138 // { dg-do compile { target c++23 } } namespace std { template T&& declval() noexcept requires true; template void declval() noexcept; namespace detail { struct none_such; template using none_such_t = none_such; template extern const none_such_t _getter_for; template using _decay_t = decltype(auto(declval())); static_assert(__is_same_as(_decay_t, void)); } template using _result_of_t = decltype(Fn(declval()...)); template using tuple_element_t = _result_of_t>, char(*)[I+1], Tuple>; template struct pair { First first; Second second; }; template inline constexpr bool _is_pair = false; template inline constexpr bool _is_pair> = true; template concept Pair = _is_pair()))>; template requires (I <= 1) decltype(auto) get(P&& p) noexcept { if constexpr (I == 0) { return (static_cast(p).first); } else { return (static_cast(p).second); } } namespace detail { inline constexpr auto _pair_getter = [](char(*)[J], Pair&& p) noexcept -> decltype(auto) { return std::get(static_cast(p)); }; template inline constexpr auto _getter_for> = _pair_getter; } } static_assert(__is_same_as(int&, std::tuple_element_t<0, std::pair&>)); static_assert(__is_same_as(float&&, std::tuple_element_t<1, std::pair&&>));