[libc++][test] Guard non-guaranteed implicit-lifetime-ness cases with _LIBCPP_VERSION#160627
Merged
frederick-vs-ja merged 2 commits intollvm:mainfrom Sep 26, 2025
Merged
Conversation
… `_LIBCPP_VERSION` And add some guaranteed cases to `is_implicit_lifetime.pass.cpp`.
Member
|
@llvm/pr-subscribers-libcxx Author: A. Jiang (frederick-vs-ja) ChangesAnd add some guaranteed cases (namely, for It's somehow unfortunate that Full diff: https://github.com/llvm/llvm-project/pull/160627.diff 1 Files Affected:
diff --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_implicit_lifetime.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_implicit_lifetime.pass.cpp
index a68f3f40e3647..6dcced8c4d000 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_implicit_lifetime.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_implicit_lifetime.pass.cpp
@@ -17,9 +17,12 @@
#include <cassert>
#include <cstddef>
+#include <expected>
+#include <optional>
#include <tuple>
#include <type_traits>
#include <utility>
+#include <variant>
#include "test_macros.h"
#include "type_algorithms.h"
@@ -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.
test_is_implicit_lifetime<std::pair<int, float>>();
test_is_implicit_lifetime<std::tuple<int, float>>();
+#endif
// Standard C23 types
|
philnik777
reviewed
Sep 25, 2025
libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_implicit_lifetime.pass.cpp
Outdated
Show resolved
Hide resolved
philnik777
approved these changes
Sep 25, 2025
Contributor
Author
|
Merging as CI failures are unrelated. |
mahesh-attarde
pushed a commit
to mahesh-attarde/llvm-project
that referenced
this pull request
Oct 3, 2025
… `_LIBCPP_VERSION` (llvm#160627) And add some guaranteed cases (namely, for `expected`, `optional`, and `variant`) to `is_implicit_lifetime.pass.cpp`. It's somehow unfortunate that `pair` and `tuple` are not guaranteed to propagate triviality of copy/move constructors, and MSVC STL fails to do so due to ABI compatibility. This affects the implicit-lifetime property.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
And add some guaranteed cases (namely, for
expected,optional, andvariant) tois_implicit_lifetime.pass.cpp.It's somehow unfortunate that
pairandtupleare not guaranteed to propagate triviality of copy/move constructors, and MSVC STL fails to do so due to ABI compatibility. This affects the implicit-lifetime property.