1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
2 
3 template <class T, T... I>
4 struct Seq {
5   static constexpr T PackSize = sizeof...(I);
6 };
7 
8 template <typename T, T N>
9 using MakeSeq = __make_integer_seq<Seq, T, N>;
10 
11 static_assert(__is_same(MakeSeq<int, 0>, Seq<int>), "");
12 static_assert(__is_same(MakeSeq<int, 1>, Seq<int, 0>), "");
13 static_assert(__is_same(MakeSeq<int, 2>, Seq<int, 0, 1>), "");
14 static_assert(__is_same(MakeSeq<int, 3>, Seq<int, 0, 1, 2>), "");
15 static_assert(__is_same(MakeSeq<int, 4>, Seq<int, 0, 1, 2, 3>), "");
16 
17 static_assert(__is_same(MakeSeq<unsigned int, 0U>, Seq<unsigned int>), "");
18 static_assert(__is_same(MakeSeq<unsigned int, 1U>, Seq<unsigned int, 0U>), "");
19 static_assert(__is_same(MakeSeq<unsigned int, 2U>, Seq<unsigned int, 0U, 1U>), "");
20 static_assert(__is_same(MakeSeq<unsigned int, 3U>, Seq<unsigned int, 0U, 1U, 2U>), "");
21 static_assert(__is_same(MakeSeq<unsigned int, 4U>, Seq<unsigned int, 0U, 1U, 2U, 3U>), "");
22 
23 static_assert(__is_same(MakeSeq<long long, 0LL>, Seq<long long>), "");
24 static_assert(__is_same(MakeSeq<long long, 1LL>, Seq<long long, 0LL>), "");
25 static_assert(__is_same(MakeSeq<long long, 2LL>, Seq<long long, 0LL, 1LL>), "");
26 static_assert(__is_same(MakeSeq<long long, 3LL>, Seq<long long, 0LL, 1LL, 2LL>), "");
27 static_assert(__is_same(MakeSeq<long long, 4LL>, Seq<long long, 0LL, 1LL, 2LL, 3LL>), "");
28 
29 static_assert(__is_same(MakeSeq<unsigned long long, 0ULL>, Seq<unsigned long long>), "");
30 static_assert(__is_same(MakeSeq<unsigned long long, 1ULL>, Seq<unsigned long long, 0ULL>), "");
31 static_assert(__is_same(MakeSeq<unsigned long long, 2ULL>, Seq<unsigned long long, 0ULL, 1ULL>), "");
32 static_assert(__is_same(MakeSeq<unsigned long long, 3ULL>, Seq<unsigned long long, 0ULL, 1ULL, 2ULL>), "");
33 static_assert(__is_same(MakeSeq<unsigned long long, 4ULL>, Seq<unsigned long long, 0ULL, 1ULL, 2ULL, 3ULL>), "");
34 
35 template <typename T, T N>
36 using ErrorSeq = __make_integer_seq<Seq, T, N>; // expected-error{{must have non-negative sequence length}} \
37                                                    expected-error{{must have integral element type}}
38 
39 enum Color : int { Red,
40                    Green,
41                    Blue };
42 using illformed1 = ErrorSeq<Color, Blue>; // expected-note{{in instantiation}}
43 
44 using illformed2 = ErrorSeq<int, -5>;
45 
46 template <typename T, T N> void f() {}
47 __make_integer_seq<f, int, 0> x; // expected-error{{template template parameter must be a class template or type alias template}}
48