PR19340: If we see a declaration of a member of an unspecialized class template
that looks like it might be an explicit specialization, don't recover as an
explicit specialization (bypassing the check that would reject that).
llvm-svn: 206444
diff --git a/clang/test/SemaTemplate/explicit-specialization-member.cpp b/clang/test/SemaTemplate/explicit-specialization-member.cpp
index 07d7389..e8dc4d2 100644
--- a/clang/test/SemaTemplate/explicit-specialization-member.cpp
+++ b/clang/test/SemaTemplate/explicit-specialization-member.cpp
@@ -38,12 +38,22 @@
template<typename T>
template<int N>
- void Baz<T>::bar() {
+ void Baz<T>::bar() { // expected-note {{couldn't infer template argument 'N'}}
}
- // FIXME: Don't suggest the 'template<>' correction here, because this cannot
- // be an explicit specialization.
+ // FIXME: We shouldn't try to match this against a prior declaration if
+ // template parameter matching failed.
template<typename T>
- void Baz<T>::bar<0>() { // expected-error {{requires 'template<>'}}
+ void Baz<T>::bar<0>() { // expected-error {{cannot specialize a member of an unspecialized template}} \
+ // expected-error {{no function template matches}}
}
}
+
+namespace PR19340 {
+template<typename T> struct Helper {
+ template<int N> static void func(const T *m) {} // expected-note {{failed template argument deduction}}
+};
+
+template<typename T> void Helper<T>::func<2>() {} // expected-error {{cannot specialize a member}} \
+ // expected-error {{no function template matches}}
+}