[libcxx-commits] [libcxx] [libc++][type_traits] Implements "A type trait to detect reference binding to temporary" (PR #128649)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Mar 6 02:16:41 PST 2025
================
@@ -1215,6 +1215,24 @@ typedef __char32_t char32_t;
# define _LIBCPP_HAS_EXPLICIT_THIS_PARAMETER 0
# endif
+// TODO(LLVM 22): Remove this macro once LLVM19 support ends.
+# if __has_builtin(__reference_constructs_from_temporary) || \
+ (defined(_LIBCPP_CLANG_VER) && \
+ ((!defined(__ANDROID__) && _LIBCPP_CLANG_VER >= 1901) || (defined(__ANDROID__) && _LIBCPP_CLANG_VER >= 1900)))
+# define _LIBCPP_HAS_REFERENCE_CONSTRUCTS_FROM_TEMPORARY 1
+# else
+# define _LIBCPP_HAS_REFERENCE_CONSTRUCTS_FROM_TEMPORARY 0
+# endif
----------------
philnik777 wrote:
This should just be `__has_builtin(__reference_constructs_from_temporary)`. 99% of people use the same version of Clang and libc++, and this is way too complicated of a condition compared to what we gain.
https://github.com/llvm/llvm-project/pull/128649
More information about the libcxx-commits
mailing list