summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaTemplate/alias-templates.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-01-25 02:14:59 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-01-25 02:14:59 +0000
commit928be491e0e9b1742b9c5f79a41ddb8cc8887012 (patch)
treef6dd3c51a9db0a4ee54fe37f5f5e114eade9eb4a /clang/test/SemaTemplate/alias-templates.cpp
parent000b14e796dc2651df708381e9cebf10d8e7eb51 (diff)
downloadbcm5719-llvm-928be491e0e9b1742b9c5f79a41ddb8cc8887012.tar.gz
bcm5719-llvm-928be491e0e9b1742b9c5f79a41ddb8cc8887012.zip
Fix PR11848: decree that an alias template contains an unexpanded parameter pack
iff its substitution contains an unexpanded parameter pack. This has the effect that we now reject declarations such as this (which we used to crash when expanding): template<typename T> using Int = int; template<typename ...Ts> void f(Int<Ts> ...ints); The standard is inconsistent on how this case should be treated. llvm-svn: 148905
Diffstat (limited to 'clang/test/SemaTemplate/alias-templates.cpp')
-rw-r--r--clang/test/SemaTemplate/alias-templates.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/clang/test/SemaTemplate/alias-templates.cpp b/clang/test/SemaTemplate/alias-templates.cpp
index 79d6849a6ef..c0f9e21b353 100644
--- a/clang/test/SemaTemplate/alias-templates.cpp
+++ b/clang/test/SemaTemplate/alias-templates.cpp
@@ -68,3 +68,36 @@ itt::thing ith(itr);
itt::rebind<bool> btr;
itt::rebind_thing<bool> btt(btr);
+
+namespace PR11848 {
+ template<typename T> using U = int;
+
+ template<typename T, typename ...Ts>
+ void f(U<T> i, U<Ts> ...is) { // expected-error {{type 'U<Ts>' (aka 'int') of function parameter pack does not contain any unexpanded parameter packs}}
+ return i + f<Ts...>(is...); // expected-error {{pack expansion does not contain any unexpanded parameter packs}}
+ }
+
+ template<typename ...Ts>
+ struct S {
+ S(U<Ts>...ts); // expected-error {{does not contain any unexpanded parameter packs}}
+ };
+
+ template<typename T>
+ struct Hidden1 {
+ template<typename ...Ts>
+ Hidden1(typename T::template U<Ts> ...ts);
+ };
+
+ template<typename T, typename ...Ts>
+ struct Hidden2 {
+ Hidden2(typename T::template U<Ts> ...ts);
+ };
+
+ struct Hide {
+ template<typename T> using U = int;
+ };
+
+ // FIXME: This case crashes clang at the moment.
+ //Hidden1<Hide> h1;
+ Hidden2<Hide, double, char> h2(1, 2);
+}
OpenPOWER on IntegriCloud