diff options
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 16 |
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); |