Find operators new/delete in base classes. FIXME -= 2;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83119 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 0ad18cd..3ca8849 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -589,10 +589,8 @@
DeclarationName Name, Expr** Args,
unsigned NumArgs, DeclContext *Ctx,
bool AllowMissing, FunctionDecl *&Operator) {
- // FIXME: Change to use LookupQualifiedName!
- DeclContext::lookup_iterator Alloc, AllocEnd;
- llvm::tie(Alloc, AllocEnd) = Ctx->lookup(Name);
- if (Alloc == AllocEnd) {
+ LookupResult R = LookupQualifiedName(Ctx, Name, LookupOrdinaryName);
+ if (!R) {
if (AllowMissing)
return false;
return Diag(StartLoc, diag::err_ovl_no_viable_function_in_call)
@@ -600,7 +598,8 @@
}
OverloadCandidateSet Candidates;
- for (; Alloc != AllocEnd; ++Alloc) {
+ for (LookupResult::iterator Alloc = R.begin(), AllocEnd = R.end();
+ Alloc != AllocEnd; ++Alloc) {
// Even member operator new/delete are implicitly treated as
// static, so don't use AddMemberCandidate.
if (FunctionDecl *Fn = dyn_cast<FunctionDecl>(*Alloc)) {
diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp
index 682ebd8..c67a3f6 100644
--- a/test/SemaCXX/new-delete.cpp
+++ b/test/SemaCXX/new-delete.cpp
@@ -38,8 +38,7 @@
ia4 *pai = new (int[3][4]);
pi = ::new int;
U *pu = new (ps) U;
- // FIXME: Inherited functions are not looked up currently.
- //V *pv = new (ps) V;
+ V *pv = new (ps) V;
pi = new (S(1.0f, 2)) int;
@@ -133,7 +132,7 @@
delete x;
}
-class X6 {
+class X5 {
public:
void Destroy() const { delete this; }
};