aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/TreeTransform.h3
-rw-r--r--test/Sema/template-specialization.cpp21
2 files changed, 23 insertions, 1 deletions
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index ef58cb62b9..2bbc41326e 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -7487,7 +7487,8 @@ TreeTransform<Derived>::TransformUnresolvedLookupExpr(
// If we have template arguments, rebuild them, then rebuild the
// templateid expression.
TemplateArgumentListInfo TransArgs(Old->getLAngleLoc(), Old->getRAngleLoc());
- if (getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
+ if (Old->hasExplicitTemplateArgs() &&
+ getDerived().TransformTemplateArguments(Old->getTemplateArgs(),
Old->getNumTemplateArgs(),
TransArgs))
return ExprError();
diff --git a/test/Sema/template-specialization.cpp b/test/Sema/template-specialization.cpp
new file mode 100644
index 0000000000..ae7bc332fc
--- /dev/null
+++ b/test/Sema/template-specialization.cpp
@@ -0,0 +1,21 @@
+// RUN: %clang_cc1 -verify -fsyntax-only %s
+// Verify the absence of assertion failures when solving calls to unresolved
+// template member functions.
+
+struct A {
+ template <typename T>
+ static void bar(int) { } // expected-note {{candidate template ignored: couldn't infer template argument 'T'}}
+};
+
+struct B {
+ template <int i>
+ static void foo() {
+ int array[i];
+ A::template bar(array[0]); // expected-error {{no matching function for call to 'bar'}}
+ }
+};
+
+int main() {
+ B::foo<4>(); // expected-note {{in instantiation of function template specialization 'B::foo<4>'}}
+ return 0;
+}