diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-12-14 03:18:05 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-12-14 03:18:05 +0000 |
commit | b300e5bbaa71a937629ab0f6034d434f75363bd6 (patch) | |
tree | ff4f672109fadb3808a0c139897a12f7700e3bbc /test/SemaTemplate | |
parent | 849480d2048277be1219fbb2e2e4da4e0542af09 (diff) | |
download | clang-b300e5bbaa71a937629ab0f6034d434f75363bd6.tar.gz clang-b300e5bbaa71a937629ab0f6034d434f75363bd6.tar.bz2 clang-b300e5bbaa71a937629ab0f6034d434f75363bd6.tar.xz |
PR18246: When performing template argument deduction to decide which template
is specialized by an explicit specialization, start from the first declaration
in case we've got a member of a class template (redeclarations might not number
the template parameters the same way).
Our recover here is still far from ideal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197305 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaTemplate')
-rw-r--r-- | test/SemaTemplate/explicit-specialization-member.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/SemaTemplate/explicit-specialization-member.cpp b/test/SemaTemplate/explicit-specialization-member.cpp index 9ddbc04953..07d7389446 100644 --- a/test/SemaTemplate/explicit-specialization-member.cpp +++ b/test/SemaTemplate/explicit-specialization-member.cpp @@ -28,3 +28,22 @@ namespace PR12331 { }; template<> struct S<int>::U { static const int n = sizeof(int); }; // expected-error {{explicit specialization of 'U' after instantiation}} } + +namespace PR18246 { + template<typename T> + class Baz { + public: + template<int N> void bar(); + }; + + template<typename T> + template<int N> + void Baz<T>::bar() { + } + + // FIXME: Don't suggest the 'template<>' correction here, because this cannot + // be an explicit specialization. + template<typename T> + void Baz<T>::bar<0>() { // expected-error {{requires 'template<>'}} + } +} |