Basic support for taking the address of an overloaded function

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59000 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 3bb7c09..a45d671 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -2511,6 +2511,8 @@
 /// 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 @@
              std::string("register variable"), op->getSourceRange());
         return QualType();
       }
-    } else 
+    } else if (isa<OverloadedFunctionDecl>(dcl))
+      return Context.OverloadTy;
+    else 
       assert(0 && "Unknown/unexpected decl type");
   }