diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AST/DeclBase.cpp | 3 | ||||
-rw-r--r-- | lib/Sema/SemaLookup.cpp | 20 |
2 files changed, 17 insertions, 6 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp index 93bee84cff..5815d820ae 100644 --- a/lib/AST/DeclBase.cpp +++ b/lib/AST/DeclBase.cpp @@ -97,6 +97,9 @@ bool Decl::isTemplateParameterPack() const { } bool Decl::isFunctionOrFunctionTemplate() const { + if (const UsingDecl *UD = dyn_cast<UsingDecl>(this)) + return UD->getTargetDecl()->isFunctionOrFunctionTemplate(); + return isa<FunctionDecl>(this) || isa<FunctionTemplateDecl>(this); } 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 |