Don't return member pointer types for static member functions. Fixes 6879261.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71961 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anders Carlsson 2009-05-16 21:43:42 +00:00
Родитель 3265a42e5a
Коммит 196f7d0ce9
2 изменённых файлов: 26 добавлений и 9 удалений

Просмотреть файл

@ -4471,17 +4471,13 @@ QualType Sema::CheckAddressOfOperand(Expr *op, SourceLocation OpLoc) {
return Context.getMemberPointerType(op->getType(),
Context.getTypeDeclType(cast<RecordDecl>(Ctx)).getTypePtr());
}
} else if (isa<FunctionDecl>(dcl)) {
} else if (CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(dcl)) {
// Okay: we can take the address of a function.
// As above.
if (isa<QualifiedDeclRefExpr>(op)) {
DeclContext *Ctx = dcl->getDeclContext();
if (Ctx && Ctx->isRecord())
return Context.getMemberPointerType(op->getType(),
Context.getTypeDeclType(cast<RecordDecl>(Ctx)).getTypePtr());
}
}
else
if (isa<QualifiedDeclRefExpr>(op) && MD->isInstance())
return Context.getMemberPointerType(op->getType(),
Context.getTypeDeclType(MD->getParent()).getTypePtr());
} else if (!isa<FunctionDecl>(dcl))
assert(0 && "Unknown/unexpected decl type");
}

Просмотреть файл

@ -0,0 +1,21 @@
// RUN: clang-cc -fsyntax-only -verify %s
typedef void (*thread_continue_t)();
extern "C" {
extern void kernel_thread_start(thread_continue_t continuation);
extern void pure_c(void);
}
class _IOConfigThread
{
public:
static void main( void );
};
void foo( void )
{
kernel_thread_start(&_IOConfigThread::main);
kernel_thread_start((thread_continue_t)&_IOConfigThread::main);
kernel_thread_start(&pure_c);
}