diff options
| author | Anders Carlsson <andersca@mac.com> | 2009-05-16 21:43:42 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2009-05-16 21:43:42 +0000 |
| commit | 5b53576fe463a9c87a093f8108cb876d6c1be875 (patch) | |
| tree | e38cef1a6bfcc88312b1fb421475b137df3f7a3a /clang/lib/Sema | |
| parent | b529b01985ae22c2819d4b7a93df7ac336f25a50 (diff) | |
| download | bcm5719-llvm-5b53576fe463a9c87a093f8108cb876d6c1be875.tar.gz bcm5719-llvm-5b53576fe463a9c87a093f8108cb876d6c1be875.zip | |
Don't return member pointer types for static member functions. Fixes 6879261.
llvm-svn: 71961
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 6a0253823c0..a31a96488ac 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -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"); } |

