Look through using declarations when searching for allocation overloads.

llvm-svn: 90961
This commit is contained in:
Anders Carlsson 2009-12-09 07:39:44 +00:00
parent 07df9efb35
commit c50b340108
2 changed files with 16 additions and 1 deletions

View File

@ -601,7 +601,8 @@ bool Sema::FindAllocationOverload(SourceLocation StartLoc, SourceRange Range,
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)) {
if (FunctionDecl *Fn =
dyn_cast<FunctionDecl>((*Alloc)->getUnderlyingDecl())) {
AddOverloadCandidate(Fn, Args, NumArgs, Candidates,
/*SuppressUserConversions=*/false);
continue;

View File

@ -202,3 +202,17 @@ struct X11 : X10 { // expected-error {{no suitable member 'operator delete' in '
void f() {
X11 x11; // expected-note {{implicit default destructor for 'struct X11' first required here}}
}
struct X12 {
void* operator new(size_t, void*);
};
struct X13 : X12 {
using X12::operator new;
};
static void* f(void* g)
{
return new (g) X13();
}