[libcxx-commits] [libcxx] [libc++] P2255R2: Set `__cpp_lib_reference_from_temporary` (PR #207920)
via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jul 7 00:48:56 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Yihan Wang (yronglin)
<details>
<summary>Changes</summary>
This PR set `__cpp_lib_reference_from_temporary` to `202202L`.
Depends https://github.com/llvm/llvm-project/pull/205379.
Fixes https://github.com/llvm/llvm-project/issues/130405.
---
Full diff: https://github.com/llvm/llvm-project/pull/207920.diff
5 Files Affected:
- (modified) libcxx/docs/FeatureTestMacroTable.rst (+1-1)
- (modified) libcxx/include/version (+1-1)
- (modified) libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.compile.pass.cpp (+10-22)
- (modified) libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp (+10-22)
- (modified) libcxx/utils/generate_feature_test_macro_components.py (+1-2)
``````````diff
diff --git a/libcxx/docs/FeatureTestMacroTable.rst b/libcxx/docs/FeatureTestMacroTable.rst
index 6bf2f35fb4212..2d8a9b513ad5c 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -398,7 +398,7 @@ Status
---------------------------------------------------------- -----------------
``__cpp_lib_ranges_zip`` ``202110L``
---------------------------------------------------------- -----------------
- ``__cpp_lib_reference_from_temporary`` *unimplemented*
+ ``__cpp_lib_reference_from_temporary`` ``202202L``
---------------------------------------------------------- -----------------
``__cpp_lib_shift`` ``202202L``
---------------------------------------------------------- -----------------
diff --git a/libcxx/include/version b/libcxx/include/version
index 4a6b01093641d..cffadf4655ce2 100644
--- a/libcxx/include/version
+++ b/libcxx/include/version
@@ -542,7 +542,7 @@ __cpp_lib_void_t 201411L <type_traits>
# define __cpp_lib_ranges_stride 202207L
# define __cpp_lib_ranges_to_container 202202L
# define __cpp_lib_ranges_zip 202110L
-// # define __cpp_lib_reference_from_temporary 202202L
+# define __cpp_lib_reference_from_temporary 202202L
# undef __cpp_lib_shift
# define __cpp_lib_shift 202202L
// # define __cpp_lib_spanstream 202106L
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.compile.pass.cpp
index cb5c008f16bb3..e69c4b5c97ea6 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/type_traits.version.compile.pass.cpp
@@ -718,17 +718,11 @@
# error "__cpp_lib_logical_traits should have the value 201510L in c++23"
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_reference_from_temporary
-# error "__cpp_lib_reference_from_temporary should be defined in c++23"
-# endif
-# if __cpp_lib_reference_from_temporary != 202202L
-# error "__cpp_lib_reference_from_temporary should have the value 202202L in c++23"
-# endif
-# else
-# ifdef __cpp_lib_reference_from_temporary
-# error "__cpp_lib_reference_from_temporary should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_reference_from_temporary
+# error "__cpp_lib_reference_from_temporary should be defined in c++23"
+# endif
+# if __cpp_lib_reference_from_temporary != 202202L
+# error "__cpp_lib_reference_from_temporary should have the value 202202L in c++23"
# endif
# ifndef __cpp_lib_remove_cvref
@@ -938,17 +932,11 @@
# error "__cpp_lib_logical_traits should have the value 201510L in c++26"
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_reference_from_temporary
-# error "__cpp_lib_reference_from_temporary should be defined in c++26"
-# endif
-# if __cpp_lib_reference_from_temporary != 202202L
-# error "__cpp_lib_reference_from_temporary should have the value 202202L in c++26"
-# endif
-# else
-# ifdef __cpp_lib_reference_from_temporary
-# error "__cpp_lib_reference_from_temporary should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_reference_from_temporary
+# error "__cpp_lib_reference_from_temporary should be defined in c++26"
+# endif
+# if __cpp_lib_reference_from_temporary != 202202L
+# error "__cpp_lib_reference_from_temporary should have the value 202202L in c++26"
# endif
# ifndef __cpp_lib_remove_cvref
diff --git a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
index f2d74cc99d864..4afa5cc09c57c 100644
--- a/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.cpp
@@ -5907,17 +5907,11 @@
# error "__cpp_lib_rcu should not be defined before c++26"
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_reference_from_temporary
-# error "__cpp_lib_reference_from_temporary should be defined in c++23"
-# endif
-# if __cpp_lib_reference_from_temporary != 202202L
-# error "__cpp_lib_reference_from_temporary should have the value 202202L in c++23"
-# endif
-# else
-# ifdef __cpp_lib_reference_from_temporary
-# error "__cpp_lib_reference_from_temporary should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_reference_from_temporary
+# error "__cpp_lib_reference_from_temporary should be defined in c++23"
+# endif
+# if __cpp_lib_reference_from_temporary != 202202L
+# error "__cpp_lib_reference_from_temporary should have the value 202202L in c++23"
# endif
# ifdef __cpp_lib_reference_wrapper
@@ -7876,17 +7870,11 @@
# endif
# endif
-# if !defined(_LIBCPP_VERSION)
-# ifndef __cpp_lib_reference_from_temporary
-# error "__cpp_lib_reference_from_temporary should be defined in c++26"
-# endif
-# if __cpp_lib_reference_from_temporary != 202202L
-# error "__cpp_lib_reference_from_temporary should have the value 202202L in c++26"
-# endif
-# else
-# ifdef __cpp_lib_reference_from_temporary
-# error "__cpp_lib_reference_from_temporary should not be defined because it is unimplemented in libc++!"
-# endif
+# ifndef __cpp_lib_reference_from_temporary
+# error "__cpp_lib_reference_from_temporary should be defined in c++26"
+# endif
+# if __cpp_lib_reference_from_temporary != 202202L
+# error "__cpp_lib_reference_from_temporary should have the value 202202L in c++26"
# endif
# ifndef __cpp_lib_reference_wrapper
diff --git a/libcxx/utils/generate_feature_test_macro_components.py b/libcxx/utils/generate_feature_test_macro_components.py
index f4e16078d5af0..9794f3d453703 100644
--- a/libcxx/utils/generate_feature_test_macro_components.py
+++ b/libcxx/utils/generate_feature_test_macro_components.py
@@ -1223,8 +1223,7 @@ def add_version_header(tc):
{
"name": "__cpp_lib_reference_from_temporary",
"values": {"c++23": 202202},
- "headers": ["type_traits"],
- "unimplemented": True,
+ "headers": ["type_traits"]
},
{
"name": "__cpp_lib_reference_wrapper",
``````````
</details>
https://github.com/llvm/llvm-project/pull/207920
More information about the libcxx-commits
mailing list