-
Notifications
You must be signed in to change notification settings - Fork 14.5k
libc++ test: update MinSequenceContainer.h to make some tests pass on MSVC STL #140287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-libcxx Author: Alex Guteniev (AlexGuteniev) ChangesPer [sequence.reqmts] there are these member functions. I did not audit if any other member functions are missing. Adding these is enough for MSVC STL Full diff: https://github.com/llvm/llvm-project/pull/140287.diff 1 Files Affected:
diff --git a/libcxx/test/support/MinSequenceContainer.h b/libcxx/test/support/MinSequenceContainer.h
index 6e61aff06344b..b17ced6dfc2ff 100644
--- a/libcxx/test/support/MinSequenceContainer.h
+++ b/libcxx/test/support/MinSequenceContainer.h
@@ -28,6 +28,13 @@ struct MinSequenceContainer {
template <class It>
explicit MinSequenceContainer(It first, It last) : data_(first, last) {}
MinSequenceContainer(std::initializer_list<T> il) : data_(il) {}
+
+ template <class It>
+ void assign(It first, It last) {
+ data_.assign(first, last);
+ }
+ void assign(std::initializer_list<T> il) { data_.assign(il); }
+ void assign(size_type n, value_type t) { data_.assign(n, t); }
iterator begin() { return iterator(data_.data()); }
const_iterator begin() const { return const_iterator(data_.data()); }
const_iterator cbegin() const { return const_iterator(data_.data()); }
@@ -47,6 +54,8 @@ struct MinSequenceContainer {
return from_vector_iterator(data_.insert(to_vector_iterator(p), std::move(value)));
}
+ iterator insert_range(const_iterator p, auto rg) { return data_.insert_range((to_vector_iterator(p), rg); }
+
iterator erase(const_iterator first, const_iterator last) {
return from_vector_iterator(data_.erase(to_vector_iterator(first), to_vector_iterator(last)));
}
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
thanks for the fix. actually i made a commit recently which relies on this helper type's absence of this means i need to refactor the test not to use MinSenquenceContainer to make CI green. |
Maybe we can solve this with prerocessor then |
Or maybe we should consider supporting this too. @StephanTLavavej , please confirm if supporting pre-C++23 containers in |
@AlexGuteniev I fixed my tests not relying on |
I'd say yes, that's a non-goal. It seems to me that if someone wants to use a new container adaptor, they can be expected to provide a sufficiently modern container. |
Thanks, but I don't think it is a path forward. The goal of my PR is to make the tests, including yours, pass with MSVC STL, so with your fix my PR does not make sense. I think we should instead use preprocessor and make |
No I don't think you should guard against libc++. Your original fix looks good to me. the helper type in the test/std folder is meant to be used for all implementations. not just libc++. Anything that is libc++ specific is our extension and should be put into test/libcxx folder. and this is what I was doing in #140372 |
Ok, will revert that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with green CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not audit if any other member functions are missing. Adding these is enough for MSVC STL
The following member functions are still missing:
from_range_t
constructor (since C++23),- constructor from
(n, t)
, operator=
frominitializer_list
,insert
taking(p, n, t)
,insert
taking(p, il)
,assign_range
(since C++23).
No change requested. I think they can be added in a following-up PR.
The affected tests are relying on the fact that `MinSequenceContainer` does not have `insert_range`. This prevents landing of #140287. This PR creates a new helper class to allow the change in MinSequenceContainer.
btw, the CI looks OK to me. the msan failure has nothing to do with your patch
This failure seems happen all the time now. |
… MSVC STL (llvm#140287) Per [sequence.reqmts] there are these member functions. I did not audit if any other member functions are missing. Adding these is enough for MSVC STL
… MSVC STL (llvm#140287) Per [sequence.reqmts] there are these member functions. I did not audit if any other member functions are missing. Adding these is enough for MSVC STL
… MSVC STL (llvm#140287) Per [sequence.reqmts] there are these member functions. I did not audit if any other member functions are missing. Adding these is enough for MSVC STL
Per [sequence.reqmts] there are these member functions.
I did not audit if any other member functions are missing. Adding these is enough for MSVC STL