Skip to content

Commit 4cdeb7d

Browse files
[libc++] Remove guards for builtins for reference binding traits (#166288)
We're only supporting Clang 20+ and Apple Clang 17 now, where these builtins are universally implemented.
1 parent ac5b615 commit 4cdeb7d

File tree

7 files changed

+6
-20
lines changed

7 files changed

+6
-20
lines changed

libcxx/include/__type_traits/reference_constructs_from_temporary.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
_LIBCPP_BEGIN_NAMESPACE_STD
2020

21-
#if _LIBCPP_STD_VER >= 23 && __has_builtin(__reference_constructs_from_temporary)
21+
#if _LIBCPP_STD_VER >= 23
2222

2323
template <class _Tp, class _Up>
2424
struct _LIBCPP_NO_SPECIALIZATIONS reference_constructs_from_temporary

libcxx/include/__type_traits/reference_converts_from_temporary.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
_LIBCPP_BEGIN_NAMESPACE_STD
2020

21-
#if _LIBCPP_STD_VER >= 23 && __has_builtin(__reference_converts_from_temporary)
21+
#if _LIBCPP_STD_VER >= 23
2222

2323
template <class _Tp, class _Up>
2424
struct _LIBCPP_NO_SPECIALIZATIONS reference_converts_from_temporary

libcxx/include/tuple

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1443,7 +1443,7 @@ template <class _Tp, class _Tuple, class = enable_if_t<__can_make_from_tuple<_Tp
14431443
inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp make_from_tuple(_Tuple&& __t)
14441444
noexcept(noexcept(std::__make_from_tuple_impl<_Tp>(std::forward<_Tuple>(__t),
14451445
make_index_sequence<tuple_size_v<remove_reference_t<_Tuple>>>()))) {
1446-
#if _LIBCPP_STD_VER >= 23 && __has_builtin(__reference_constructs_from_temporary)
1446+
#if _LIBCPP_STD_VER >= 23
14471447
if constexpr (tuple_size_v<remove_reference_t<_Tuple>> == 1) {
14481448
static_assert(!std::reference_constructs_from_temporary_v<_Tp, decltype(std::get<0>(std::declval<_Tuple>()))>,
14491449
"Attempted construction of reference element binds to a temporary whose lifetime has ended");

libcxx/test/libcxx/type_traits/no_specializations.verify.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,10 @@ SPECIALIZE_UTT(is_unbounded_array); // expected-error 2 {{cannot be speciali
154154
# endif
155155

156156
# if TEST_STD_VER >= 23
157-
SPECIALIZE_UTT(is_implicit_lifetime); // expected-error 2 {{cannot be specialized}}
158-
SPECIALIZE_UTT(is_scoped_enum); // expected-error 2 {{cannot be specialized}}
159-
# if __has_builtin(__reference_constructs_from_temporary)
157+
SPECIALIZE_UTT(is_implicit_lifetime); // expected-error 2 {{cannot be specialized}}
158+
SPECIALIZE_UTT(is_scoped_enum); // expected-error 2 {{cannot be specialized}}
160159
SPECIALIZE_BTT(reference_constructs_from_temporary); // expected-error 2 {{cannot be specialized}}
161-
# endif
162-
# if __has_builtin(__reference_converts_from_temporary)
163-
SPECIALIZE_BTT(reference_converts_from_temporary); // expected-error 2 {{cannot be specialized}}
164-
# endif
160+
SPECIALIZE_BTT(reference_converts_from_temporary); // expected-error 2 {{cannot be specialized}}
165161
# endif
166162

167163
# if TEST_STD_VER >= 26

libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_constructs_from_temporary.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

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

11-
// These compilers don't support std::reference_converts_from_temporary yet.
12-
// UNSUPPORTED: apple-clang-16, clang-19.1
13-
1411
// <type_traits>
1512

1613
// template<class T, class U> struct reference_constructs_from_temporary;

libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/reference_converts_from_temporary.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

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

11-
// These compilers don't support std::reference_converts_from_temporary yet.
12-
// UNSUPPORTED: apple-clang-16, clang-19.1
13-
1411
// <type_traits>
1512

1613
// template<class T, class U> struct reference_converts_from_temporary;

libcxx/test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.verify.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@
1919
#include "test_macros.h"
2020

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

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

0 commit comments

Comments
 (0)