https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93793
Bug ID: 93793
Summary: std::ostream_iterator doesn't satisfy
std::weakly_incrementable
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: cjdb.ns at gmail dot com
Target Milestone: ---
Created attachment 47864
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47864&action=edit
Minimal repro
It appears that ostream_iterator::difference_type is still void when -std=c++2a
is enabled.
* Branch: GCC trunk
* Version: g++ (GCC) 10.0.1 20200217 (experimental)
* Git Hash: cd23cdb1743b41baed0b937c4b359b9422490ca7
* GCC configured with: ../gcc/configure --disable-nls --disable-multilib
--enable-languages=c,c++ --disable-werror
* GCC built with: CFLAGS='-O3 -g0 -w' CXXFLAGS='-O3 -g0 -w'
LDFLAGS='-fuse-ld=gold'
* System: Ubuntu 18.04 (WSL)
* GCC invocation: g++ -std=c++2a
* Output:
```
ostream_iterator.cpp:5:20: error: static assertion failed
5 | static_assert(std::weakly_incrementable<std::ostream_iterator<int>>);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ostream_iterator.cpp:5:20: note: constraints not satisfied
In file included from
/usr/local/include/c++/10.0.1/bits/stl_iterator_base_types.h:71,
from /usr/local/include/c++/10.0.1/iterator:61,
from ostream_iterator.cpp:2:
/usr/local/include/c++/10.0.1/bits/iterator_concepts.h:505:13: required by
the constraints of 'template<class _Iter> concept std::weakly_incrementable'
/usr/local/include/c++/10.0.1/bits/iterator_concepts.h:507:10: in
requirements with 'std::ostream_iterator<int> __i'
/usr/local/include/c++/10.0.1/bits/iterator_concepts.h:510:21: note: nested
requirement '__is_signed_integer_like<typename
std::__detail::__iter_traits_impl<typename std::remove_cv<typename
std::remove_reference<_Tp>::type>::type, std::incrementable_traits<typename
std::remove_cv<typename std::remove_reference<_Tp>::type>::type>
>::type::difference_type>' is not satisfied
510 | requires __detail::__is_signed_integer_like<iter_difference_t<_Iter>>;
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```