summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.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/SemaDeclCXX.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/SemaDeclCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 3495880d22f..2f43e5fa9ec 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -1529,6 +1529,22 @@ Sema::CheckReferenceInit(Expr *&Init, QualType &DeclType,
QualType T1 = DeclType->getAsReferenceType()->getPointeeType();
QualType T2 = Init->getType();
+ // If the initializer is the address of an overloaded function, try
+ // to resolve the overloaded function. If all goes well, T2 is the
+ // type of the resulting function.
+ if (T2->isOverloadType()) {
+ FunctionDecl *Fn = ResolveAddressOfOverloadedFunction(Init, DeclType,
+ ICS != 0);
+ if (Fn) {
+ // Since we're performing this reference-initialization for
+ // real, update the initializer with the resulting function.
+ if (!ICS)
+ FixOverloadedFunctionReference(Init, Fn);
+
+ T2 = Fn->getType();
+ }
+ }
+
// Compute some basic properties of the types and the initializer.
bool DerivedToBase = false;
Expr::isLvalueResult InitLvalue = Init->isLvalue(Context);
OpenPOWER on IntegriCloud