[libcxx-commits] [libcxx] [libc++] Use `__reference_constructs_from_temporary` if eligible (PR #141916)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Thu May 29 02:05:15 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);
----------------
frederick-vs-ja wrote:
Do we want to use an internal type trait now?
Also, it seems that the `static_assert` on such problematic reference binding is totally non-Standard before C++23, and not strictly conforming even since C++23. Should we remove such checks, or backport the part of P2255R2 for `tuple` to old modes?
https://github.com/llvm/llvm-project/pull/141916
More information about the libcxx-commits
mailing list