Bug 85040 - [8 Regression] std::less<void> fails when operator< is overloaded
Summary: [8 Regression] std::less<void> fails when operator< is overloaded
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libstdc++ (show other bugs)
Version: 8.0
: P1 normal
Target Milestone: 8.0
Assignee: Jonathan Wakely
URL:
Keywords: rejects-valid
Depends on:
Blocks: 78420
  Show dependency treegraph
 
Reported: 2018-03-22 12:54 UTC by Jonathan Wakely
Modified: 2024-01-07 17:05 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-03-22 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Wakely 2018-03-22 12:54:17 UTC
#include <functional>

struct string { } s;
bool operator<(const string&, const string&) { return false; }

std::less<> lt;
bool b = lt(s, s);

This fails since the fix for PR 78420
Comment 1 Jonathan Wakely 2018-03-22 14:23:59 UTC
Author: redi
Date: Thu Mar 22 14:23:27 2018
New Revision: 258773

URL: https://gcc.gnu.org/viewcvs?rev=258773&root=gcc&view=rev
Log:
PR libstdc++/85040 fix std::less<void> etc. ambiguities

	PR libstdc++/85040
	* include/bits/stl_function.h (greater::__not_overloaded)
	(less::__not_overloaded, greater_equal::__not_overloaded)
	(less_equal::__not_overloaded): Fix ambiguous specializations.
	* testsuite/20_util/function_objects/comparisons_pointer.cc: Add
	tests for type with overlaoded operators.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/stl_function.h
    trunk/libstdc++-v3/testsuite/20_util/function_objects/comparisons_pointer.cc
Comment 2 Jonathan Wakely 2018-03-22 14:25:07 UTC
Fixed.