|
40 | 40 | #include "llvm/ADT/ScopeExit.h" |
41 | 41 | #include "llvm/ADT/SmallPtrSet.h" |
42 | 42 | #include "llvm/ADT/SmallVector.h" |
| 43 | +#include "llvm/Support/Casting.h" |
43 | 44 | #include <algorithm> |
44 | 45 | #include <cassert> |
45 | 46 | #include <cstddef> |
@@ -10724,15 +10725,13 @@ bool clang::isBetterOverloadCandidate( |
10724 | 10725 | // -- F1 is a constructor for a class D, F2 is a constructor for a base |
10725 | 10726 | // class B of D, and for all arguments the corresponding parameters of |
10726 | 10727 | // F1 and F2 have the same type. |
10727 | | - // FIXME: Implement the "all parameters have the same type" check. |
10728 | | - bool Cand1IsInherited = |
10729 | | - isa_and_nonnull<ConstructorUsingShadowDecl>(Cand1.FoundDecl.getDecl()); |
10730 | | - bool Cand2IsInherited = |
10731 | | - isa_and_nonnull<ConstructorUsingShadowDecl>(Cand2.FoundDecl.getDecl()); |
10732 | | - if (Cand1IsInherited != Cand2IsInherited) |
10733 | | - return Cand2IsInherited; |
10734 | | - else if (Cand1IsInherited) { |
10735 | | - assert(Cand2IsInherited); |
| 10728 | + if (isa_and_nonnull<CXXConstructorDecl>(Cand1.Function) && |
| 10729 | + isa_and_nonnull<CXXConstructorDecl>(Cand2.Function) && |
| 10730 | + llvm::equal(Cand1.Function->parameters().take_front(NumArgs), |
| 10731 | + Cand2.Function->parameters().take_front(NumArgs), |
| 10732 | + [&](ParmVarDecl *P1, ParmVarDecl *P2) { |
| 10733 | + return S.Context.hasSameUnqualifiedType(P1->getType(), P2->getType()); |
| 10734 | + })) { |
10736 | 10735 | auto *Cand1Class = cast<CXXRecordDecl>(Cand1.Function->getDeclContext()); |
10737 | 10736 | auto *Cand2Class = cast<CXXRecordDecl>(Cand2.Function->getDeclContext()); |
10738 | 10737 | if (Cand1Class->isDerivedFrom(Cand2Class)) |
|
0 commit comments