summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2008-11-10 20:40:00 +0000
committerDouglas Gregor <dgregor@apple.com>2008-11-10 20:40:00 +0000
commitcd695e500de7e628b1feb3425423dec85eb4d5ba (patch)
tree15fd5d04bd245b48af239bc199c129001dcd65b6 /clang/lib/Sema/SemaExpr.cpp
parent74eefb5722372f49280e452fa680fb3da8aa1ab0 (diff)
downloadbcm5719-llvm-cd695e500de7e628b1feb3425423dec85eb4d5ba.tar.gz
bcm5719-llvm-cd695e500de7e628b1feb3425423dec85eb4d5ba.zip
Basic support for taking the address of an overloaded function
llvm-svn: 59000
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 3bb7c09ce86..a45d6717b79 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -2511,6 +2511,8 @@ static NamedDecl *getPrimaryDecl(Expr *E) {
/// object cannot be declared with storage class register or be a bit field.
/// Note: The usual conversions are *not* applied to the operand of the &
/// operator (C99 6.3.2.1p[2-4]), and its result is never an lvalue.
+/// In C++, the operand might be an overloaded function name, in which case
+/// we allow the '&' but retain the overloaded-function type.
QualType Sema::CheckAddressOfOperand(Expr *op, SourceLocation OpLoc) {
if (getLangOptions().C99) {
// Implement C99-only parts of addressof rules.
@@ -2554,7 +2556,9 @@ QualType Sema::CheckAddressOfOperand(Expr *op, SourceLocation OpLoc) {
std::string("register variable"), op->getSourceRange());
return QualType();
}
- } else
+ } else if (isa<OverloadedFunctionDecl>(dcl))
+ return Context.OverloadTy;
+ else
assert(0 && "Unknown/unexpected decl type");
}
OpenPOWER on IntegriCloud