зеркало из https://github.com/microsoft/clang-1.git
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
This commit is contained in:
Родитель
bf1cc05907
Коммит
5d64e5b6bc
|
@ -589,10 +589,8 @@ bool Sema::FindAllocationOverload(SourceLocation StartLoc, SourceRange Range,
|
||||||
DeclarationName Name, Expr** Args,
|
DeclarationName Name, Expr** Args,
|
||||||
unsigned NumArgs, DeclContext *Ctx,
|
unsigned NumArgs, DeclContext *Ctx,
|
||||||
bool AllowMissing, FunctionDecl *&Operator) {
|
bool AllowMissing, FunctionDecl *&Operator) {
|
||||||
// FIXME: Change to use LookupQualifiedName!
|
LookupResult R = LookupQualifiedName(Ctx, Name, LookupOrdinaryName);
|
||||||
DeclContext::lookup_iterator Alloc, AllocEnd;
|
if (!R) {
|
||||||
llvm::tie(Alloc, AllocEnd) = Ctx->lookup(Name);
|
|
||||||
if (Alloc == AllocEnd) {
|
|
||||||
if (AllowMissing)
|
if (AllowMissing)
|
||||||
return false;
|
return false;
|
||||||
return Diag(StartLoc, diag::err_ovl_no_viable_function_in_call)
|
return Diag(StartLoc, diag::err_ovl_no_viable_function_in_call)
|
||||||
|
@ -600,7 +598,8 @@ bool Sema::FindAllocationOverload(SourceLocation StartLoc, SourceRange Range,
|
||||||
}
|
}
|
||||||
|
|
||||||
OverloadCandidateSet Candidates;
|
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
|
// Even member operator new/delete are implicitly treated as
|
||||||
// static, so don't use AddMemberCandidate.
|
// static, so don't use AddMemberCandidate.
|
||||||
if (FunctionDecl *Fn = dyn_cast<FunctionDecl>(*Alloc)) {
|
if (FunctionDecl *Fn = dyn_cast<FunctionDecl>(*Alloc)) {
|
||||||
|
|
|
@ -38,8 +38,7 @@ void good_news()
|
||||||
ia4 *pai = new (int[3][4]);
|
ia4 *pai = new (int[3][4]);
|
||||||
pi = ::new int;
|
pi = ::new int;
|
||||||
U *pu = new (ps) U;
|
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;
|
pi = new (S(1.0f, 2)) int;
|
||||||
|
|
||||||
|
@ -133,7 +132,7 @@ void X4::release(X3 *x) {
|
||||||
delete x;
|
delete x;
|
||||||
}
|
}
|
||||||
|
|
||||||
class X6 {
|
class X5 {
|
||||||
public:
|
public:
|
||||||
void Destroy() const { delete this; }
|
void Destroy() const { delete this; }
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче