diff options
Diffstat (limited to 'test/SemaTemplate/explicit-specialization-member.cpp')
-rw-r--r-- | test/SemaTemplate/explicit-specialization-member.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/test/SemaTemplate/explicit-specialization-member.cpp b/test/SemaTemplate/explicit-specialization-member.cpp index 07d73894468f..e8dc4d219acb 100644 --- a/test/SemaTemplate/explicit-specialization-member.cpp +++ b/test/SemaTemplate/explicit-specialization-member.cpp @@ -38,12 +38,22 @@ namespace PR18246 { 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}} +} |