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

            Bug ID: 68190
           Summary: iterator mix up with set::find and heterogenous lookup
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: howard.hinnant at gmail dot com
  Target Milestone: ---

This fails to compile because template <class Key> set::find is returning the
wrong iterator type (I think).

#include <set>

    struct Comparator
    {
        using is_transparent = std::true_type;

        bool
        operator() (int x, unsigned y) const
        {
            return x < y;
        }


        bool
        operator() (unsigned x, int y) const
        {
            return x < y;
        }


        bool
        operator() (int x, int y) const
        {
            return x < y;
        }

    };

int
main()
{
    std::set<int, Comparator> s;
    s.insert(1);
    auto iter = s.find(1u);
    iter = s.erase(iter);
}

Reply via email to