1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
template<typename T, T ...Values> struct value_tuple {};
template<typename T>
struct X0 {
template<T ...Values>
void f(value_tuple<T, Values...> * = 0);
};
void test_X0() {
X0<int>().f<1, 2, 3, 4, 5>();
}
namespace PacksAtDifferentLevels {
template<typename...> struct tuple { };
template<typename T, typename U> struct pair { };
template<typename ...Types>
struct X {
template<typename> struct Inner {
static const unsigned value = 1;
};
template<typename ...YTypes>
struct Inner<tuple<pair<Types, YTypes>...> > {
static const unsigned value = sizeof...(Types) - sizeof...(YTypes);
};
};
int check0[X<short, int, long>::Inner<tuple<pair<short, unsigned short>,
pair<int, unsigned int>,
pair<long, unsigned long>>
>::value == 0? 1 : -1];
int check1[X<short, int>::Inner<tuple<pair<short, unsigned short>,
pair<int, unsigned int>,
pair<long, unsigned long>>
>::value == 1? 1 : -1];
template<unsigned ...Values> struct unsigned_tuple { };
template<typename ...Types>
struct X1 {
template<typename, typename> struct Inner {
static const unsigned value = 0;
};
template<typename ...YTypes>
struct Inner<tuple<pair<Types, YTypes>...>,
unsigned_tuple<sizeof(Types) + sizeof(YTypes)...>> {
static const unsigned value = 1;
};
};
int check2[X1<short, int, long>::Inner<tuple<pair<short, unsigned short>,
pair<int, unsigned int>,
pair<long, unsigned long>>,
unsigned_tuple<sizeof(short) + sizeof(unsigned short),
sizeof(int) + sizeof(unsigned int),
sizeof(long) + sizeof(unsigned long)>
>::value == 1? 1 : -1];
int check3[X1<short, int>::Inner<tuple<pair<short, unsigned short>,
pair<int, unsigned int>,
pair<long, unsigned long>>,
unsigned_tuple<sizeof(short) + sizeof(unsigned short),
sizeof(int) + sizeof(unsigned int),
sizeof(long) + sizeof(unsigned long)>
>::value == 0? 1 : -1];
template<typename ...Types>
struct X2 {
template<typename> struct Inner {
static const unsigned value = 1;
};
template<typename R, typename ...YTypes>
struct Inner<R(pair<Types, YTypes>...)> {
static const unsigned value = sizeof...(Types) - sizeof...(YTypes);
};
};
int check4[X2<short, int, long>::Inner<int(pair<short, unsigned short>,
pair<int, unsigned int>,
pair<long, unsigned long>)
>::value == 0? 1 : -1];
int check5[X2<short, int>::Inner<int(pair<short, unsigned short>,
pair<int, unsigned int>,
pair<long, unsigned long>)
>::value == 1? 1 : -1];
template<typename T, typename U>
struct some_function_object {
template<typename>
struct result_of;
};
template<template<class> class...> struct metafun_tuple { };
template<typename ...Types1>
struct X3 {
template<typename, typename> struct Inner {
static const unsigned value = 0;
};
template<typename ...Types2>
struct Inner<tuple<pair<Types1, Types2>...>,
metafun_tuple<some_function_object<Types1, Types2>::template result_of...> > {
static const unsigned value = 1;
};
};
int check6[X3<short, int, long>::Inner<tuple<pair<short, unsigned short>,
pair<int, unsigned int>,
pair<long, unsigned long>>,
metafun_tuple<
some_function_object<short, unsigned short>::result_of,
some_function_object<int, unsigned int>::result_of,
some_function_object<long, unsigned long>::result_of>
>::value == 1? 1 : -1];
int check7[X3<short, int>::Inner<tuple<pair<short, unsigned short>,
pair<int, unsigned int>,
pair<long, unsigned long>>,
metafun_tuple<
some_function_object<short, unsigned short>::result_of,
some_function_object<int, unsigned int>::result_of,
some_function_object<long, unsigned long>::result_of>
>::value == 0? 1 : -1];
template<unsigned I, unsigned J> struct unsigned_pair { };
template<unsigned ...Values1>
struct X4 {
template<typename> struct Inner {
static const unsigned value = 0;
};
template<unsigned ...Values2>
struct Inner<tuple<unsigned_pair<Values1, Values2>...>> {
static const unsigned value = 1;
};
};
int check8[X4<1, 3, 5>::Inner<tuple<unsigned_pair<1, 2>,
unsigned_pair<3, 4>,
unsigned_pair<5, 6>>
>::value == 1? 1 : -1];
int check9[X4<1, 3>::Inner<tuple<unsigned_pair<1, 2>,
unsigned_pair<3, 4>,
unsigned_pair<5, 6>>
>::value == 0? 1 : -1];
}
|