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 //===----------------------------------------------------------------------===//
11 // template <size_t I, class T, size_t N> const T& get(const array<T, N>& a);
16 #include "test_macros.h"
18 // std::array is explicitly allowed to be initialized with A a = { init-list };.
19 // Disable the missing braces warning for this reason.
20 #include "disable_missing_braces_warning.h"
26 typedef std::array
<T
, 3> C
;
27 const C c
= {1, 2, 3.5};
28 assert(std::get
<0>(c
) == 1);
29 assert(std::get
<1>(c
) == 2);
30 assert(std::get
<2>(c
) == 3.5);
35 typedef std::array
<T
, 3> C
;
36 constexpr const C c
= {1, 2, 3.5};
37 static_assert(std::get
<0>(c
) == 1, "");
38 static_assert(std::get
<1>(c
) == 2, "");
39 static_assert(std::get
<2>(c
) == 3.5, "");