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

            Bug ID: 67617
           Summary: Non-standard const requirements imposed on associate
                    container comparison objects
           Product: gcc
           Version: 4.8.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mdempsky at google dot com
  Target Milestone: ---

This code appears to me to be conforming to the C++ standard, but it's rejected
by G++/libstdc++:

    #include <set>
    struct compare {
      bool operator()(int a, int b);
    };
    void func() {
      const std::set<int, compare> s;
      s.find(0);
    }

because compare::operator() is not const qualified.

N3690 [associative.reqmts]p2 says "The object of type Compare is called the
comparison object of the container", and p3 talks about the requirements on
behavior of a comparison object comp.  However, none of the requirements seem
to impose requirements on objects of type const Compare.

Reply via email to