-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc++] tests with picolibc: Fix iterator diff_type to std::streamoff #74072
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: Dominik Wójt (domin144) ChangesThe hardcoded value of long int was not valid for newlib and picolibc. Full diff: https://github.com/llvm/llvm-project/pull/74072.diff 1 Files Affected:
diff --git a/libcxx/test/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp b/libcxx/test/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp
index f56750bb495e15f..3f8c9c2ad8d0221 100644
--- a/libcxx/test/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp
+++ b/libcxx/test/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp
@@ -11,11 +11,6 @@
// This test uses iterator types from std::filesystem
// XFAIL: availability-filesystem-missing
-// std::same_as<typename Traits::difference_type, DiffType> failed.
-// The former was long and the latter was long long.
-// Possibly related to "using streamoff = long int" in ios.h.
-// XFAIL: LIBCXX-PICOLIBC-FIXME
-
// template<class T>
// struct iterator_traits;
@@ -152,8 +147,7 @@ static_assert(testIOIterator<std::insert_iterator<std::vector<int>>, std::output
static_assert(testConst<std::istream_iterator<int, char>, std::input_iterator_tag, int>());
#if !defined(TEST_HAS_NO_LOCALIZATION)
-// libc++-specific since pointer type is unspecified:
-LIBCPP_STATIC_ASSERT(test<std::istreambuf_iterator<char>, std::input_iterator_tag, char, long long, char, char*>());
+static_assert(test<std::istreambuf_iterator<char>, std::input_iterator_tag, char, std::streamoff, char, char*>());
static_assert(test<std::move_iterator<int*>, std::random_access_iterator_tag, int, std::ptrdiff_t, int&&, int*>());
static_assert(testIOIterator<std::ostream_iterator<int, char>, std::output_iterator_tag>());
static_assert(testIOIterator<std::ostreambuf_iterator<int, char>, std::output_iterator_tag>());
|
The proposed check is no longer libc++ specific. It follows this derivation:
Further is libc++ specific.
As an alternative, the ifdefs from |
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, thanks for the clean up.
Please rebase onto main and push again, it'll trigger the CI again. I just fixed an issue on GCC. |
...est/std/iterators/iterator.primitives/iterator.traits/cxx20_iterator_traits.compile.pass.cpp
Outdated
Show resolved
Hide resolved
The hardcoded value of long int was not valid for newlib and picolibc.
c4a7bc4
to
df18502
Compare
✅ With the latest revision this PR passed the C/C++ code formatter. |
a19d96f
to
a38d413
Compare
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, pending CI.
The hardcoded value of long int was not valid for newlib and picolibc.