This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/68190] New: iterator mix up with set::find and heterogenous lookup
- From: "howard.hinnant at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 02 Nov 2015 18:41:11 +0000
- Subject: [Bug libstdc++/68190] New: iterator mix up with set::find and heterogenous lookup
- Auto-submitted: auto-generated
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);
}