Implement taking address of member functions, including overloaded ones.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63779 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 66cbdfd..6671037 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -3498,11 +3498,18 @@
}
} else if (isa<FunctionDecl>(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
assert(0 && "Unknown/unexpected decl type");
}
-
+
// If the operand has type "type", the result has type "pointer to type".
return Context.getPointerType(op->getType());
}