зеркало из https://github.com/microsoft/clang-1.git
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:
Родитель
3265a42e5a
Коммит
196f7d0ce9
|
@ -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);
|
||||
}
|
Загрузка…
Ссылка в новой задаче