[clang] [Clang] CWG2789 Overload resolution with implicit and explicit object… (PR #73493)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 27 10:52:21 PST 2023
================
@@ -10121,22 +10143,41 @@ static bool haveSameParameterTypes(ASTContext &Context, const FunctionDecl *F1,
/// We're allowed to use constraints partial ordering only if the candidates
/// have the same parameter types:
-/// [over.match.best]p2.6
-/// F1 and F2 are non-template functions with the same parameter-type-lists,
-/// and F1 is more constrained than F2 [...]
+/// [over.match.best.general]p2.6
+/// F1 and F2 are non-template functions with the same
+/// non-object-parameter-type-lists, and F1 is more constrained than F2 [...]
static bool sameFunctionParameterTypeLists(Sema &S,
- const OverloadCandidate &Cand1,
- const OverloadCandidate &Cand2) {
- if (Cand1.Function && Cand2.Function) {
- auto *PT1 = cast<FunctionProtoType>(Cand1.Function->getFunctionType());
- auto *PT2 = cast<FunctionProtoType>(Cand2.Function->getFunctionType());
- if (PT1->getNumParams() == PT2->getNumParams() &&
- PT1->isVariadic() == PT2->isVariadic() &&
- S.FunctionParamTypesAreEqual(PT1, PT2, nullptr,
- Cand1.isReversed() ^ Cand2.isReversed()))
- return true;
+ const OverloadCandidate &Cand1,
+ const OverloadCandidate &Cand2) {
+ if (!Cand1.Function || !Cand2.Function)
+ return false;
+
+ auto *Fn1 = Cand1.Function;
+ auto *Fn2 = Cand2.Function;
----------------
AaronBallman wrote:
Please spell out the types explicitly as they're not spelled by the initializer.
https://github.com/llvm/llvm-project/pull/73493
More information about the cfe-commits
mailing list