diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-01-11 01:59:33 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-01-11 01:59:33 +0000 |
commit | 64095fc07c737333f5bab96f2998d54de08a8251 (patch) | |
tree | b65fe3cb29f409f34cf7755afb8b0825cca57770 /clang/lib/Sema/SemaDecl.cpp | |
parent | 5488ab4ddd47af2151d79940e805914da56d6562 (diff) | |
download | bcm5719-llvm-64095fc07c737333f5bab96f2998d54de08a8251.tar.gz bcm5719-llvm-64095fc07c737333f5bab96f2998d54de08a8251.zip |
Remember to instantiate explicit template argument lists in a friend
function declaration.
We'd previously often just drop these on the floor, and friend
redeclaration matching would usually (but not always) figure out the
right redeclaration anyway.
Also, don't try to match a dependent friend function template
specialization to a template until instantiation, and don't forget to
reject qualified friend declarations in dependent contexts that don't
name an already-declared entity.
llvm-svn: 350915
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 2b88955285f..f77aeb64b36 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -9030,10 +9030,14 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // selecting a friend based on a dependent factor. But there // are situations where these conditions don't apply and we // can actually do this check immediately. + // + // Unless the scope is dependent, it's always an error if qualified + // redeclaration lookup found nothing at all. Diagnose that now; + // nothing will diagnose that error later. if (isFriend && - (TemplateParamLists.size() || - D.getCXXScopeSpec().getScopeRep()->isDependent() || - CurContext->isDependentContext())) { + (D.getCXXScopeSpec().getScopeRep()->isDependent() || + (!Previous.empty() && (TemplateParamLists.size() || + CurContext->isDependentContext())))) { // ignore these } else { // The user tried to provide an out-of-line definition for a |