[libc++][test] Mark optional test functions as TEST_CONSTEXPR_CXX20#94172
Merged
philnik777 merged 2 commits intollvm:mainfrom Jun 3, 2024
Merged
[libc++][test] Mark optional test functions as TEST_CONSTEXPR_CXX20#94172philnik777 merged 2 commits intollvm:mainfrom
optional test functions as TEST_CONSTEXPR_CXX20#94172philnik777 merged 2 commits intollvm:mainfrom
Conversation
Member
|
@llvm/pr-subscribers-libcxx Author: Stephan T. Lavavej (StephanTLavavej) ChangesP2231R1 "Missing Found while running libc++'s tests with MSVC's STL, as we activate our Full diff: https://github.com/llvm/llvm-project/pull/94172.diff 2 Files Affected:
diff --git a/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp b/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp
index 17a1e94b0ba6e..631052cad94b9 100644
--- a/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp
+++ b/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp
@@ -210,7 +210,7 @@ void test_on_test_type() {
}
}
-constexpr bool test_empty_emplace()
+TEST_CONSTEXPR_CXX20 bool test_empty_emplace()
{
optional<const int> opt;
auto &v = opt.emplace(42);
diff --git a/libcxx/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp b/libcxx/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp
index 112ee213b42a6..c8c0b01060608 100644
--- a/libcxx/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp
+++ b/libcxx/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp
@@ -31,7 +31,7 @@ struct X
bool X::dtor_called = false;
-constexpr bool check_reset()
+TEST_CONSTEXPR_CXX20 bool check_reset()
{
{
optional<int> opt;
|
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
philnik777
approved these changes
Jun 3, 2024
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.
P2231R1 "Missing
constexprinstd::optionalandstd::variant" was accepted as a C++20 Defect Report, not a C++17 Defect Report. Accordingly,test_empty_emplace()andcheck_reset()should be marked asTEST_CONSTEXPR_CXX20. Note that theirstatic_asserts are properly guarded:llvm-project/libcxx/test/std/utilities/optional/optional.object/optional.object.assign/emplace.pass.cpp
Lines 270 to 272 in 4ce6542
llvm-project/libcxx/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp
Lines 53 to 55 in 4ce6542
Found while running libc++'s tests with MSVC's STL, as we activate our
constexprhere for C++20 and above.