Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

_LIBCPP_BEGIN_NAMESPACE_STD

#if _LIBCPP_STD_VER >= 23 && __has_builtin(__reference_constructs_from_temporary)
#if _LIBCPP_STD_VER >= 23

template <class _Tp, class _Up>
struct _LIBCPP_NO_SPECIALIZATIONS reference_constructs_from_temporary
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

_LIBCPP_BEGIN_NAMESPACE_STD

#if _LIBCPP_STD_VER >= 23 && __has_builtin(__reference_converts_from_temporary)
#if _LIBCPP_STD_VER >= 23

template <class _Tp, class _Up>
struct _LIBCPP_NO_SPECIALIZATIONS reference_converts_from_temporary
Expand Down
2 changes: 1 addition & 1 deletion libcxx/include/tuple
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ template <class _Tp, class _Tuple, class = enable_if_t<__can_make_from_tuple<_Tp
inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp make_from_tuple(_Tuple&& __t)
noexcept(noexcept(std::__make_from_tuple_impl<_Tp>(std::forward<_Tuple>(__t),
make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>()))) {
#if _LIBCPP_STD_VER >= 23 && __has_builtin(__reference_constructs_from_temporary)
#if _LIBCPP_STD_VER >= 23
if constexpr (tuple_size_v<remove_reference_t<_Tuple>> == 1) {
static_assert(!std::reference_constructs_from_temporary_v<_Tp, decltype(std::get<0>(std::declval<_Tuple>()))>,
"Attempted construction of reference element binds to a temporary whose lifetime has ended");
Expand Down
10 changes: 3 additions & 7 deletions libcxx/test/libcxx/type_traits/no_specializations.verify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,10 @@ SPECIALIZE_UTT(is_unbounded_array); // expected-error 2 {{cannot be speciali
# endif

# if TEST_STD_VER >= 23
SPECIALIZE_UTT(is_implicit_lifetime); // expected-error 2 {{cannot be specialized}}
SPECIALIZE_UTT(is_scoped_enum); // expected-error 2 {{cannot be specialized}}
# if __has_builtin(__reference_constructs_from_temporary)
SPECIALIZE_UTT(is_implicit_lifetime); // expected-error 2 {{cannot be specialized}}
SPECIALIZE_UTT(is_scoped_enum); // expected-error 2 {{cannot be specialized}}
SPECIALIZE_BTT(reference_constructs_from_temporary); // expected-error 2 {{cannot be specialized}}
# endif
# if __has_builtin(__reference_converts_from_temporary)
SPECIALIZE_BTT(reference_converts_from_temporary); // expected-error 2 {{cannot be specialized}}
# endif
SPECIALIZE_BTT(reference_converts_from_temporary); // expected-error 2 {{cannot be specialized}}
# endif

# if TEST_STD_VER >= 26
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

// REQUIRES: std-at-least-c++23

// These compilers don't support std::reference_converts_from_temporary yet.
// UNSUPPORTED: apple-clang-16, clang-19.1

// <type_traits>

// template<class T, class U> struct reference_constructs_from_temporary;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

// REQUIRES: std-at-least-c++23

// These compilers don't support std::reference_converts_from_temporary yet.
// UNSUPPORTED: apple-clang-16, clang-19.1

// <type_traits>

// template<class T, class U> struct reference_converts_from_temporary;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
#include "test_macros.h"

void test() {
// FreeBSD ci use clang 19.1.1, which hasn't implement __reference_constructs_from_temporary.
// The static_assert inner std::make_from_tuple will not triggered.
#if __has_builtin(__reference_constructs_from_temporary)
// expected-error@*:* {{static assertion failed}}
#endif

// Turns to an error since C++26 (Disallow Binding a Returned Glvalue to a Temporary https://wg21.link/P2748R5).
#if TEST_STD_VER >= 26
Expand Down
Loading