[libcxx-commits] [libcxx] [libc++] tests with picolibc: Fix iterator diff_type to std::streamoff (PR #74072)
Dominik Wójt via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Dec 1 04:47:44 PST 2023
domin144 wrote:
@ldionne @zoecarver
The proposed check is no longer libc++ specific. It follows this derivation:
```
std::iterator_traits<std::istreambuf_iterator<char>>::difference_type
= std::istreambuf_iterator<char>::difference_type
= typename Traits::off_type (Traits = std::char_traits<char>)
= std::char_traits<char>::off_type
= std::streamoff
```
Further is libc++ specific. `std::streamoff` is defined in `libcxx/include/__fwd/ios.h`
```
#if defined(_NEWLIB_VERSION)
// On newlib, off_t is 'long int'
using streamoff = long int; // for char_traits in <string>
#else
using streamoff = long long; // for char_traits in <string>
#endif
```
As an alternative, the ifdefs from `ios.h` could be reproduced in the test, making it libc++ specific again.
https://github.com/llvm/llvm-project/pull/74072
More information about the libcxx-commits
mailing list