Skip to content

Commit a975ead

Browse files
[libc++][test] Guard non-guaranteed implicit-lifetime-ness cases with _LIBCPP_VERSION
And add some guaranteed cases to `is_implicit_lifetime.pass.cpp`.
1 parent a3d7c46 commit a975ead

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_implicit_lifetime.pass.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@
1717

1818
#include <cassert>
1919
#include <cstddef>
20+
#include <expected>
21+
#include <optional>
2022
#include <tuple>
2123
#include <type_traits>
2224
#include <utility>
25+
#include <variant>
2326

2427
#include "test_macros.h"
2528
#include "type_algorithms.h"
@@ -216,8 +219,17 @@ constexpr bool test() {
216219

217220
// C++ standard library types
218221

222+
// These types are guaranteed to be implicit-lifetime.
223+
test_is_implicit_lifetime<std::expected<int, float>>();
224+
test_is_implicit_lifetime<std::optional<float>>();
225+
test_is_implicit_lifetime<std::variant<float, int>>();
226+
227+
#ifdef _LIBCPP_VERSION
228+
// These types should be implicit-lifetime, but they are not guaranteed to be so.
229+
// Especially, MSVC STL has not made them implicit-lifetime yet. See https://github.com/microsoft/STL/issues/5667.
219230
test_is_implicit_lifetime<std::pair<int, float>>();
220231
test_is_implicit_lifetime<std::tuple<int, float>>();
232+
#endif
221233

222234
// Standard C23 types
223235

0 commit comments

Comments
 (0)