15a83710eSEric Fiselier //===----------------------------------------------------------------------===//
25a83710eSEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65a83710eSEric Fiselier //
75a83710eSEric Fiselier //===----------------------------------------------------------------------===//
85a83710eSEric Fiselier
9*31cbe0f2SLouis Dionne // UNSUPPORTED: c++03, c++11
105a83710eSEric Fiselier // <utility>
115a83710eSEric Fiselier
125a83710eSEric Fiselier // template<class T, T... I>
135a83710eSEric Fiselier // struct integer_sequence
145a83710eSEric Fiselier // {
155a83710eSEric Fiselier // typedef T type;
165a83710eSEric Fiselier //
175a83710eSEric Fiselier // static constexpr size_t size() noexcept;
185a83710eSEric Fiselier // };
195a83710eSEric Fiselier
205a83710eSEric Fiselier #include <utility>
215a83710eSEric Fiselier #include <type_traits>
228d113d43SMarshall Clow #include <cstddef>
235a83710eSEric Fiselier #include <cassert>
245a83710eSEric Fiselier
257fc6a556SMarshall Clow #include "test_macros.h"
267fc6a556SMarshall Clow
main(int,char **)272df59c50SJF Bastien int main(int, char**)
285a83710eSEric Fiselier {
295a83710eSEric Fiselier // Make a few of sequences
305a83710eSEric Fiselier using int3 = std::integer_sequence<int, 3, 2, 1>;
318d113d43SMarshall Clow using size1 = std::integer_sequence<std::size_t, 7>;
325a83710eSEric Fiselier using ushort2 = std::integer_sequence<unsigned short, 4, 6>;
335a83710eSEric Fiselier using bool0 = std::integer_sequence<bool>;
345a83710eSEric Fiselier
355a83710eSEric Fiselier // Make sure they're what we expect
365a83710eSEric Fiselier static_assert ( std::is_same<int3::value_type, int>::value, "int3 type wrong" );
375a83710eSEric Fiselier static_assert ( int3::size() == 3, "int3 size wrong" );
385a83710eSEric Fiselier
398d113d43SMarshall Clow static_assert ( std::is_same<size1::value_type, std::size_t>::value, "size1 type wrong" );
405a83710eSEric Fiselier static_assert ( size1::size() == 1, "size1 size wrong" );
415a83710eSEric Fiselier
425a83710eSEric Fiselier static_assert ( std::is_same<ushort2::value_type, unsigned short>::value, "ushort2 type wrong" );
435a83710eSEric Fiselier static_assert ( ushort2::size() == 2, "ushort2 size wrong" );
445a83710eSEric Fiselier
455a83710eSEric Fiselier static_assert ( std::is_same<bool0::value_type, bool>::value, "bool0 type wrong" );
465a83710eSEric Fiselier static_assert ( bool0::size() == 0, "bool0 size wrong" );
472df59c50SJF Bastien
482df59c50SJF Bastien return 0;
495a83710eSEric Fiselier }
50