From: Richard Smith Date: Wed, 6 Jun 2018 16:36:56 +0000 (+0000) Subject: PR37680: fix faulty assertion condition. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29aed5067f7fed62152613e217865e01b0ff8cff;p=clang PR37680: fix faulty assertion condition. When looking up a template name, we can find an overload set containing a function template and an unresolved non-type using declaration. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334106 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index c759c96be5..64f45af618 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -7292,6 +7292,7 @@ ASTContext::getOverloadedTemplateName(UnresolvedSetIterator Begin, for (UnresolvedSetIterator I = Begin; I != End; ++I) { NamedDecl *D = *I; assert(isa(D) || + isa(D) || (isa(D) && isa(D->getUnderlyingDecl()))); *Storage++ = D; diff --git a/test/SemaTemplate/dependent-names.cpp b/test/SemaTemplate/dependent-names.cpp index 05ef33b535..67ef238083 100644 --- a/test/SemaTemplate/dependent-names.cpp +++ b/test/SemaTemplate/dependent-names.cpp @@ -447,3 +447,15 @@ namespace DependentUnresolvedUsingTemplate { xb.h(); // expected-note {{instantiation of}} } } + +namespace PR37680 { + template struct b : a { + using a::add; + template int add() { return this->template add(0); } + }; + struct a { + template int add(...); + void add(int); + }; + int f(b ba) { return ba.add<0>(); } +}