[libcxx-commits] [libcxx] [libc++] Use `__reference_constructs_from_temporary` if eligible (PR #141916)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Fri May 30 06:57:20 PDT 2025
================
@@ -310,7 +310,9 @@ class __tuple_leaf {
template <class _Tp>
static _LIBCPP_HIDE_FROM_ABI constexpr bool __can_bind_reference() {
-# if __has_keyword(__reference_binds_to_temporary)
+# if __has_builtin(__reference_constructs_from_temporary)
+ return !__reference_constructs_from_temporary(_Hp, _Tp);
----------------
philnik777 wrote:
Yes, we should switch to an internal trait. I don't think we should remove such checks. IMO it's a _way_ better user experience to reject definitely wrong code than to accept it knowing that it will blow up if it's ever executed. I'm quite certain there is no case where we reject intended code.
Yes, if the type trait is available in all compilers we can remove the checks.
https://github.com/llvm/llvm-project/pull/141916
More information about the libcxx-commits
mailing list