This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/65861] libstdc++ is silently generating wrong code when its std::search is given an input iterator


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65861

--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
There are actually good reasons *not* to reject input iterators at
compile-time.

You could have an iterator which meets most, but not all, the forward iterator
requirements, and so must have input_iterator_tag as its category. Such as
iterator could work fine with std::search, if we don't reject it via a static
assertion.

(istreambuf_iterator is not such an iterator, as it's genuinely a single-pass
iterator, and so can't be used ... but we can't reliably detect that as the
only property we can test is the iterator_category tag).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]