]> granicus.if.org Git - clang/commitdiff
PR37680: fix faulty assertion condition.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 6 Jun 2018 16:36:56 +0000 (16:36 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 6 Jun 2018 16:36:56 +0000 (16:36 +0000)
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

lib/AST/ASTContext.cpp
test/SemaTemplate/dependent-names.cpp

index c759c96be5bbe074b6ceea0ae7550aea74d7fcce..64f45af61899ba3a80a477228f9f280159d692ff 100644 (file)
@@ -7292,6 +7292,7 @@ ASTContext::getOverloadedTemplateName(UnresolvedSetIterator Begin,
   for (UnresolvedSetIterator I = Begin; I != End; ++I) {
     NamedDecl *D = *I;
     assert(isa<FunctionTemplateDecl>(D) ||
+           isa<UnresolvedUsingValueDecl>(D) ||
            (isa<UsingShadowDecl>(D) &&
             isa<FunctionTemplateDecl>(D->getUnderlyingDecl())));
     *Storage++ = D;
index 05ef33b535a335678ac37077090805fd3914e029..67ef238083f04630c35dc435a6fcaa762e726d79 100644 (file)
@@ -447,3 +447,15 @@ namespace DependentUnresolvedUsingTemplate {
     xb.h(); // expected-note {{instantiation of}}
   }
 }
+
+namespace PR37680 {
+  template <class a> struct b : a {
+    using a::add;
+    template<int> int add() { return this->template add(0); }
+  };
+  struct a {
+    template<typename T = void> int add(...);
+    void add(int);
+  };
+  int f(b<a> ba) { return ba.add<0>(); }
+}