• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <utility>
10 
11 // template<class T, T N>
12 //   using make_integer_sequence = integer_sequence<T, 0, 1, ..., N-1>;
13 
14 // UNSUPPORTED: c++03, c++11
15 
16 // This test hangs during recursive template instantiation with libstdc++
17 // UNSUPPORTED: libstdc++
18 
19 #include <utility>
20 #include <type_traits>
21 #include <cassert>
22 
23 #include "test_macros.h"
24 
main(int,char **)25 int main(int, char**)
26 {
27   typedef std::make_integer_sequence<int, -3> MakeSeqT;
28 
29   // std::make_integer_sequence is implemented using a compiler builtin if available.
30   // this builtin has different diagnostic messages than the fallback implementation.
31 #if TEST_HAS_BUILTIN(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE)
32     MakeSeqT i; // expected-error@utility:* {{integer sequences must have non-negative sequence length}}
33 #else
34     MakeSeqT i; // expected-error@utility:* {{static_assert failed "std::make_integer_sequence must have a non-negative sequence length"}}
35 #endif
36 
37   return 0;
38 }
39