[libcxx-commits] [libcxx] [libc++] tests with picolibc: Fix iterator diff_type to std::streamoff (PR #74072)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Dec 1 06:36:56 PST 2023


================
@@ -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*>());
----------------
ldionne wrote:

I suggest we do this instead:

```
// We use std::istreambuf_iterator<char>::pointer because it's unspecified, it doesn't have to be char*
static_assert(test<std::istreambuf_iterator<char>, std::input_iterator_tag, char, std::streamoff, char, std::istreambuf_iterator<char>::pointer>());
```

We don't need to pin down `char*` here. We already have a test that ensures that libc++ is using `char*`: https://github.com/llvm/llvm-project/blob/main/libcxx/test/std/iterators/stream.iterators/istreambuf.iterator/types.pass.cpp#L49

https://github.com/llvm/llvm-project/pull/74072


More information about the libcxx-commits mailing list