diff options
Diffstat (limited to 'lib/Sema/SemaLookup.cpp')
-rw-r--r-- | lib/Sema/SemaLookup.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index e1c6302fcc..d76761c696 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -139,16 +139,24 @@ MaybeConstructOverloadSet(ASTContext &Context, // nothing to leak. Ovl = OverloadedFunctionDecl::Create(Context, (*I)->getDeclContext(), (*I)->getDeclName()); - if (isa<FunctionDecl>(*I)) - Ovl->addOverload(cast<FunctionDecl>(*I)); + NamedDecl *ND = (*I); + if (UsingDecl *UD = dyn_cast<UsingDecl>(ND)) + ND = UD->getTargetDecl(); + + if (isa<FunctionDecl>(ND)) + Ovl->addOverload(cast<FunctionDecl>(ND)); else - Ovl->addOverload(cast<FunctionTemplateDecl>(*I)); + Ovl->addOverload(cast<FunctionTemplateDecl>(ND)); } - if (isa<FunctionDecl>(*Last)) - Ovl->addOverload(cast<FunctionDecl>(*Last)); + NamedDecl *ND = (*Last); + if (UsingDecl *UD = dyn_cast<UsingDecl>(ND)) + ND = UD->getTargetDecl(); + + if (isa<FunctionDecl>(ND)) + Ovl->addOverload(cast<FunctionDecl>(ND)); else - Ovl->addOverload(cast<FunctionTemplateDecl>(*Last)); + Ovl->addOverload(cast<FunctionTemplateDecl>(ND)); } // If we had more than one function, we built an overload |