111
|
1 // Various tests for variadic templates and partial specialization.
|
|
2 // { dg-do compile { target c++11 } }
|
|
3
|
|
4 // PR c++/36846
|
|
5 template<typename A, typename B>
|
|
6 struct pair;
|
|
7
|
|
8 template<typename... T>
|
|
9 struct pairs;
|
|
10
|
|
11 template<typename... AS, typename... BS>
|
|
12 struct pairs<pair<AS, BS>...> {
|
|
13 struct mismatched_packs {};
|
|
14 };
|
|
15
|
|
16 template class pairs<
|
|
17 pair<int, int>,
|
|
18 pair<int, int>
|
|
19 >;
|
|
20
|
|
21 template<int A, int B>
|
|
22 struct point;
|
|
23
|
|
24 template<typename... T>
|
|
25 struct points;
|
|
26
|
|
27 template<int... AS, int... BS>
|
|
28 struct points<point<AS, BS>...> {
|
|
29 struct mismatched_packs {};
|
|
30 };
|
|
31
|
|
32 template class points<
|
|
33 point<0, 1>,
|
|
34 point<0, 1>
|
|
35 >;
|
|
36
|
|
37 // PR c++/35477
|
|
38 template <class...ARGS> struct tuple {};
|
|
39 template <class A, class B> struct test {};
|
|
40 template <class... ARGS, class B> struct test<B, tuple<ARGS...>>
|
|
41 {
|
|
42 template <class T> struct inside {};
|
|
43 };
|
|
44
|
|
45 // PR c++/38276
|
|
46 template<typename...> struct A;
|
|
47
|
|
48 template<typename, typename> struct B;
|
|
49
|
|
50 template<typename... T, typename... U> struct B<A<T...>, A<U...> >
|
|
51 {
|
|
52 static int i;
|
|
53 };
|
|
54
|
|
55 B<A<>, A<int> > b1;
|
|
56
|
|
57 B<A<int>, A<> > b2;
|
|
58
|
|
59 // PR c++/35784
|
|
60 template <typename...> struct p;
|
|
61
|
|
62 template <typename, typename> struct d;
|
|
63
|
|
64 template <typename... A, typename... B>
|
|
65 struct d<p<A...>, p<B...> > { typedef int t; };
|
|
66
|
|
67 typedef d<p<>, p<int, float> >::t q;
|
|
68 typedef d<q, d<p<int>, p<float> >::t> r; // *
|
|
69
|
|
70 typedef d<d<p<>, p<int, float> >::t, d<p<>, p<> >::t> s;
|