[libcxx-commits] [libcxx] [libc++][type_traits] Implements "A type trait to detect reference binding to temporary" (PR #128649)

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Wed Feb 26 01:23:16 PST 2025


================
@@ -0,0 +1,124 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: std-at-least-c++23
+
+// These compilers don't support std::reference_converts_from_temporary yet.
+// UNSUPPORTED: android, apple-clang-15, apple-clang-16.1, apple-clang-16.2, clang-19
----------------
H-G-Hristov wrote:

AFAIK. `__has_builtin(__reference_converts_from_temporary)` should work in Clang 18, it is broken on Clang 19.1.1 (what I use right now) it should be fixed with this patch
https://github.com/llvm/llvm-project/commit/dedbdfb70daf06fc07bb4dfbec1d18af8fcef28f
What is not clear to me, was it fixed in Clang 19.1.2 or in Clang 19.1.7.

```C++
#if __has_builtin(__reference_converts_from_temporary) || (defined(_LIBCPP_COMPILER_CLANG_BASED) && (__clang_major == 18 || (__clang_major >= 19 && __clang_minor >= 2))
...
```
I don't have access to macOS any longer. Xcode 16.3 should be based on LLVM19 but I guess we won't get the fix before Xcode 17.

https://github.com/llvm/llvm-project/pull/128649


More information about the libcxx-commits mailing list