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

Gast128 <gast128 at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gast128 at hotmail dot com

--- Comment #12 from Gast128 <gast128 at hotmail dot com> ---
I would also prefer a compile time error if --it or (it - n) is not there
instead of routing it to ++it. One get a compilation error with
_GLIBCXX_CONCEPT_CHECKS but jwakely on Reddit (you?) stated that these checks
are broken.

We recently got a crash when porting to Linux since on MSVC std::unordered_map
supports bidirectional iterators while on GCC it's only forward iterators (as
cpppreference state that this is the minimum). The code compiled fine but gave
a crash when invoking std::prev(umap.cend()).

Also it seems that iterator category calculation is not always precise.
Consider following example:

struct Dummy
{
    int GetId() const
    {
        return m_id;
    }

    int m_id = 0;
};


std::vector<Dummy> vec;

auto rng = vec | std::views::transform(&Dummy::GetId);

using It    = decltype(rng.end());
using ItCat = typename std::iterator_traits<It>::iterator_category;

static_assert(std::is_same_v<ItCat, std::input_iterator_tag>);

The input iterator category is both determined by MSVC and GCC.

Reply via email to