[libcxx-commits] [PATCH] D144262: [libc++][ranges] Implement LWG-3865 Sorting a range of pairs

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Feb 25 01:50:06 PST 2023


philnik added inline comments.


================
Comment at: libcxx/test/std/utilities/tuple/tuple.tuple/tuple.apply/make_from_tuple.pass.cpp:68
-    return lhs.first == rhs.first && lhs.second == rhs.second;
-}
-
----------------
frederick-vs-ja wrote:
> Mordante wrote:
> > We typically back-port LWG issues to older language versions.
> > However I'm a bit wary of retroactively applying this LWG issue, since it may affect existing code.
> > Looking at MSVC STL it seems @strega-nil has the same concerns.
> > https://github.com/microsoft/STL/pull/3476/files/4f2ec495a6b5e6ab61d504663b0ad7d3db9db547#r1110452521
> > 
> > Since `operator==` and `operator<=>` are added/changed in C++20, I feel less wary to change it there.
> > Doing this back to C++03 feels a bit scary.
> > 
> > @ldionne What's your opinion?
> > 
> > 
> The changes do break such not-so-reasonable code:
> ```
> struct BadPairs : std::pair<int, int>, std::pair<long, long> {};
> std::pair<int, int>{} == BadPairs{};
> ```
> And some uses of (IMO, unreasonable) explicit usage of `operartor@(p, x)` or `operator@<T, U>(p, x)`.
> 
> I think if we provide both old and new overloads, almost nothing is broken (except some code expecting incomparability).
Given that you aren't allowed to explicitly specify template parameters unless the standard explicitly allows it, I think we can break at least that part. I don't really expect a lot of code to be broken in the wild, so I think it should be OK to back-port to C++03. Since we are early in the release cycle we can also just land it for now; if enough people complain we can revert.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144262/new/

https://reviews.llvm.org/D144262



More information about the libcxx-commits mailing list