[Bug libstdc++/68880] [4.9 Regression][Bisected to r202992] std::operator< overload ignored when using std::lower_bound

2015-12-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68880

--- Comment #4 from Jonathan Wakely  ---
For future reference, [4.9 Regression] means a regression in gcc 4.9 compared
to previous versions. What you meant is [5/6 Regression], and you should have
put 4.9.4 (or another version) in the "Known to work" field.

It doesn't matter here though, because as stated above this is undefined
behaviour not a regression (IMHO refusing to compile this code is a nice side
effect of François's change).

[Bug libstdc++/68880] [4.9 Regression][Bisected to r202992] std::operator< overload ignored when using std::lower_bound

2015-12-14 Thread david.ward at ll dot mit.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68880

--- Comment #5 from David Ward  ---
Jonathan, the behavior changed between 4.8 and 4.9. Testing with the 4.9
release showed the new behavior as well. I showed the output from the latest
release to demonstrate that the behavior still exists and hadn't changed back
since 4.9 (and also checked this with SVN trunk).

[Bug libstdc++/68880] [4.9 Regression][Bisected to r202992] std::operator< overload ignored when using std::lower_bound

2015-12-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68880

--- Comment #6 from Jonathan Wakely  ---
I see, sorry, I read "The output below is from gcc 5.3.0, but I just checked
that it is still broken in SVN trunk" to mean it was ok in 4.9

Then it should have been "[4.9/5/6 Regression]" (and all regressions need to
have at least the "known to work" field set).

[Bug libstdc++/68880] [4.9 Regression][Bisected to r202992] std::operator< overload ignored when using std::lower_bound

2015-12-13 Thread david.ward at ll dot mit.edu
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68880

David Ward  changed:

   What|Removed |Added

 Status|RESOLVED|CLOSED

--- Comment #3 from David Ward  ---
You are correct; sorry for the noise. I got mixed up by the requirements for
specializing std::less<> versus overloading operator<().

[Bug libstdc++/68880] [4.9 Regression][Bisected to r202992] std::operator< overload ignored when using std::lower_bound

2015-12-13 Thread fdumont at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68880

--- Comment #1 from François Dumont  ---
Not sure it is a regression. Of course before the patch the operator was called
in namespace std so your operator was considered. Now we are using intermediate
functor that are not in std namespace so your operator is hidden to those
functors.

I don't think the Standard is saying that we should consider namespace std in
this context. So your best choice is simply to put your operator in namespace N
rather than polluting the std one. I hope someone with higher C++ Standard
knowledge will confirm.

[Bug libstdc++/68880] [4.9 Regression][Bisected to r202992] std::operator< overload ignored when using std::lower_bound

2015-12-13 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68880

Markus Trippelsdorf  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 CC||trippels at gcc dot gnu.org
 Resolution|--- |INVALID

--- Comment #2 from Markus Trippelsdorf  ---
Yes, this invokes undefined behavior.
See:  http://en.cppreference.com/w/cpp/language/extending_std