[libcxx-commits] [libcxx] [libc++][test] Guard non-guaranteed implicit-lifetime-ness cases with `_LIBCPP_VERSION` (PR #160627)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Thu Sep 25 00:19:24 PDT 2025


================
@@ -216,8 +219,17 @@ constexpr bool test() {
 
   // C++ standard library types
 
+  // These types are guaranteed to be implicit-lifetime.
+  test_is_implicit_lifetime<std::expected<int, float>>();
+  test_is_implicit_lifetime<std::optional<float>>();
+  test_is_implicit_lifetime<std::variant<float, int>>();
+
+#ifdef _LIBCPP_VERSION
+  // These types should be implicit-lifetime, but they are not guaranteed to be so.
+  // Especially, MSVC STL has not made them implicit-lifetime yet. See https://github.com/microsoft/STL/issues/5667.
----------------
philnik777 wrote:

If these aren't guaranteed to be, we don't need to document the stance of other implementations. We do that nowhere else AFAIK.

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


More information about the libcxx-commits mailing list