This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/71545] [6/7 Regression] Incorrect irreflexive comparison debug check in std::lower_bound
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 17 Jun 2016 15:04:25 +0000
- Subject: [Bug libstdc++/71545] [6/7 Regression] Incorrect irreflexive comparison debug check in std::lower_bound
- Auto-submitted: auto-generated
- References: <bug-71545-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71545
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The irreflexive assertion is incorrect for lexicographical compare too:
#include <algorithm>
struct X { };
bool operator<(X, int) { return true; }
bool operator<(int, X) { return false; }
// Not a strict weak order
bool operator<(X, X) { return true; }
int main()
{
X x[1];
int i[1];
std::lexicographical_compare(x, x+1, i, i+1);
}
This fails in Debug Mode because operator<(X, X) doesn't define a strict weak
order, but that operator is not used by the algorithm.