public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ensadc at mailnesia dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/95983] New: `std::counted_iterator<std::iterator_t<std::ranges::basic_istream_view<...>>>` fails to satisfy `std::input_or_output_iterator`
Date: Mon, 29 Jun 2020 18:19:14 +0000 [thread overview]
Message-ID: <bug-95983-4@http.gcc.gnu.org/bugzilla/> (raw)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95983
Bug ID: 95983
Summary: `std::counted_iterator<std::iterator_t<std::ranges::ba
sic_istream_view<...>>>` fails to satisfy
`std::input_or_output_iterator`
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: ensadc at mailnesia dot com
Target Milestone: ---
https://wandbox.org/permlink/rUZlUGG4UFeWicbM
====
#include <ranges>
#include <iterator>
#include <iostream>
using R =
std::ranges::basic_istream_view<int, char, std::char_traits<char>>;
using It = std::ranges::iterator_t<R>;
static_assert(std::input_or_output_iterator<std::counted_iterator<It>>);
====
prog.cc:5:20: error: static assertion failed
5 | static_assert(std::input_or_output_iterator<std::counted_iterator<T>>);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
prog.cc:5:20: note: constraints not satisfied
In file included from
/opt/wandbox/gcc-head/include/c++/11.0.0/bits/stl_iterator_base_types.h:71,
from /opt/wandbox/gcc-head/include/c++/11.0.0/iterator:61,
from /opt/wandbox/gcc-head/include/c++/11.0.0/ranges:44,
from prog.cc:1:
/opt/wandbox/gcc-head/include/c++/11.0.0/bits/iterator_concepts.h:536:13:
required for the satisfaction of 'weakly_incrementable<_Iter>' [with _Iter =
std::counted_iterator<std::ranges::basic_istream_view<int, char,
std::char_traits<char> >::_Iterator<int, char, std::char_traits<char> > >]
/opt/wandbox/gcc-head/include/c++/11.0.0/bits/iterator_concepts.h:538:10: in
requirements with '_Iter __i' [with _Tp =
std::counted_iterator<std::ranges::basic_istream_view<int, char,
std::char_traits<char> >::_Iterator<int, char, std::char_traits<char> > >;
_Iter = std::counted_iterator<std::ranges::basic_istream_view<int, char,
std::char_traits<char> >::_Iterator<int, char, std::char_traits<char> > >]
/opt/wandbox/gcc-head/include/c++/11.0.0/bits/iterator_concepts.h:540:11: note:
the required type 'std::iter_difference_t<_Iter>' is invalid
540 | typename iter_difference_t<_Iter>;
| ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/opt/wandbox/gcc-head/include/c++/11.0.0/bits/iterator_concepts.h:541: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
541 | requires __detail::__is_signed_integer_like<iter_difference_t<_Iter>>;
| ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: note: set '-fconcepts-diagnostics-depth=' to at least 2 for more
detail
====
It seems that in this case, `iter_difference_t` is treated as an alias of
`std::iterator_traits<std::counted_iterator<It>>::difference_type` (which
doesn't exist), because libstdc++ defines a specialization of
`std::iterator_traits<std::counted_iterator<It>>`.
(The error message is worse than it should be, due to bug 94862 and bug 95303.)
next reply other threads:[~2020-06-29 18:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-29 18:19 ensadc at mailnesia dot com [this message]
2020-07-08 14:56 ` [Bug libstdc++/95983] " redi at gcc dot gnu.org
2020-07-27 5:07 ` ensadc at mailnesia dot com
2021-04-19 10:40 ` redi at gcc dot gnu.org
2021-04-20 3:52 ` ppalka at gcc dot gnu.org
2021-04-20 7:45 ` gcc-bugs at marehr dot dialup.fu-berlin.de
2021-04-20 13:19 ` cvs-commit at gcc dot gnu.org
2021-04-20 13:20 ` cvs-commit at gcc dot gnu.org
2021-04-20 15:39 ` ppalka at gcc dot gnu.org
2021-04-20 15:59 ` ppalka at gcc dot gnu.org
2021-05-04 13:51 ` cvs-commit at gcc dot gnu.org
2021-05-04 13:52 ` ppalka at gcc dot gnu.org
2021-05-04 20:21 ` gcc-bugs at marehr dot dialup.fu-berlin.de
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-95983-4@http.gcc.gnu.org/bugzilla/ \
--to=gcc-bugzilla@gcc.gnu.org \
--cc=gcc-bugs@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).