[clang] p2085 out-of-class comparison operator defaulting
authorNathan Sidwell <nathan@acm.org>
Wed, 16 Jun 2021 17:43:43 +0000 (10:43 -0700)
committerNathan Sidwell <nathan@acm.org>
Thu, 16 Dec 2021 15:22:46 +0000 (07:22 -0800)
commit5fbe21a7748f91adbd1b16c95bbfe180642320a3
tree00d7abe5269dd0da18cf1a6680706eaa6c5cae84
parent5aefb1dc1eabd9286da9511b5227aa83443091b9
[clang] p2085 out-of-class comparison operator defaulting

This implements p2085, allowing out-of-class defaulting of comparison
operators, primarily so they need not be inline, IIUC intent. this was
mostly straigh forward, but required reimplementing
Sema::CheckExplicitlyDefaultedComparison, as now there's a case where
we have no a priori clue as to what class a defaulted comparison may
be for. We have to inspect the parameter types to find out. Eg:

class X { ... };
bool operator==(X, X) = default;

Thus reimplemented the parameter type checking, and added 'is this a
friend' functionality for the above case.

Reviewed By: mizvekov

Differential Revision: https://reviews.llvm.org/D104478
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/Sema/SemaDeclCXX.cpp
clang/test/CXX/class/class.compare/class.compare.default/p1.cpp
clang/test/CodeGenCXX/p2085.cpp [new file with mode: 0644]
clang/www/cxx_status.html