summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-02-16 00:36:47 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-02-16 00:36:47 +0000
commit4e05eaa9e84a271cdaf810ed5a981f1afd54aad9 (patch)
treebd1d31dc9223337f5362e4b85b57c8d8b0727636 /clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
parent7386ceac7453d1839bf6c89ec5d6b989b3818520 (diff)
downloadbcm5719-llvm-4e05eaa9e84a271cdaf810ed5a981f1afd54aad9.tar.gz
bcm5719-llvm-4e05eaa9e84a271cdaf810ed5a981f1afd54aad9.zip
[c++1z] Diagnose non-deducible template parameters in deduction guide templates, per [temp.param]p11.
llvm-svn: 295264
Diffstat (limited to 'clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp')
-rw-r--r--clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp b/clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
index 011130d0e77..3d256aa6705 100644
--- a/clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
+++ b/clang/test/SemaCXX/cxx1z-class-template-argument-deduction.cpp
@@ -150,3 +150,21 @@ namespace look_into_current_instantiation {
C c = {1, 2};
}
+
+namespace nondeducible {
+ template<typename A, typename B> struct X {};
+
+ template<typename A> // expected-note {{non-deducible template parameter 'A'}}
+ X() -> X<A, int>; // expected-error {{deduction guide template contains a template parameter that cannot be deduced}}
+
+ template<typename A> // expected-note {{non-deducible template parameter 'A'}}
+ X(typename X<A, int>::type) -> X<A, int>; // expected-error {{deduction guide template contains a template parameter that cannot be deduced}}
+
+ template<typename A = int,
+ typename B> // expected-note {{non-deducible template parameter 'B'}}
+ X(int) -> X<A, B>; // expected-error {{deduction guide template contains a template parameter that cannot be deduced}}
+
+ template<typename A = int,
+ typename ...B>
+ X(float) -> X<A, B...>; // ok
+}
OpenPOWER on IntegriCloud