1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // Make sure std::array is an aggregate type.
10 // We can only check this in C++17 and above, because we don't have the
12 // UNSUPPORTED: c++03, c++11, c++14
15 #include <type_traits>
18 void check_aggregate()
20 static_assert(std::is_aggregate
<std::array
<T
, 0> >::value
, "");
21 static_assert(std::is_aggregate
<std::array
<T
, 1> >::value
, "");
22 static_assert(std::is_aggregate
<std::array
<T
, 2> >::value
, "");
23 static_assert(std::is_aggregate
<std::array
<T
, 3> >::value
, "");
24 static_assert(std::is_aggregate
<std::array
<T
, 4> >::value
, "");
28 struct Trivial
{ int i
; int j
; };
31 NonTrivial(NonTrivial
const&) { }
36 check_aggregate
<char>();
37 check_aggregate
<int>();
38 check_aggregate
<long>();
39 check_aggregate
<float>();
40 check_aggregate
<double>();
41 check_aggregate
<long double>();
42 check_aggregate
<Empty
>();
43 check_aggregate
<Trivial
>();
44 check_aggregate
<NonTrivial
>();