summaryrefslogtreecommitdiffstats
path: root/test/CXX/temp/temp.deduct.guide/p1.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-02-09 22:47:51 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-02-09 22:47:51 +0000
commit32f0979f8f43e8655ac3173ae9d93a411111d873 (patch)
tree49c694a58c6eaec32aa41b5c8b1a08ce2eac9117 /test/CXX/temp/temp.deduct.guide/p1.cpp
parent7bf80c8d8f328456a72c31e07837096023b6659b (diff)
Disallow explicit instantiation and explicit specialization for deduction guides.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@294641 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/temp/temp.deduct.guide/p1.cpp')
-rw-r--r--test/CXX/temp/temp.deduct.guide/p1.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/CXX/temp/temp.deduct.guide/p1.cpp b/test/CXX/temp/temp.deduct.guide/p1.cpp
index 8dd0720669..c0a2ba1129 100644
--- a/test/CXX/temp/temp.deduct.guide/p1.cpp
+++ b/test/CXX/temp/temp.deduct.guide/p1.cpp
@@ -86,3 +86,23 @@ A(int(&)[43]) -> A<int> try {} catch (...) {} // expected-error {{deduction guid
#ifdef CLASS
};
#endif
+
+namespace ExplicitInst {
+ // Explicit instantiation / specialization is not permitted.
+ template<typename T> struct B {};
+ template<typename T> B(T) -> B<T>;
+ template<> B(int) -> B<int>; // expected-error {{deduction guide cannot be explicitly specialized}}
+ extern template B(float) -> B<float>; // expected-error {{deduction guide cannot be explicitly instantiated}}
+ template B(char) -> B<char>; // expected-error {{deduction guide cannot be explicitly instantiated}}
+
+ // An attempt at partial specialization doesn't even parse as a deduction-guide.
+ template<typename T> B<T*>(T*) -> B<T*>; // expected-error 1+{{}} expected-note 0+{{}}
+
+ struct X {
+ template<typename T> struct C {};
+ template<typename T> C(T) -> C<T>;
+ template<> C(int) -> C<int>; // expected-error {{explicit specialization of '<deduction guide for C>' in class scope}}
+ extern template C(float) -> C<float>; // expected-error {{expected member name or ';'}}
+ template C(char) -> C<char>; // expected-error {{expected '<' after 'template'}}
+ };
+}