[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / containers / sequences / array / array.tuple / get_const.pass.cpp
blob3c1941c031fb3abb15b04b8f58b213f371b3fcfb
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 //===----------------------------------------------------------------------===//
9 // <array>
11 // template <size_t I, class T, size_t N> const T& get(const array<T, N>& a);
13 #include <array>
14 #include <cassert>
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"
22 TEST_CONSTEXPR_CXX14 bool tests()
25 std::array<double, 1> const array = {3.3};
26 assert(std::get<0>(array) == 3.3);
29 std::array<double, 2> const array = {3.3, 4.4};
30 assert(std::get<0>(array) == 3.3);
31 assert(std::get<1>(array) == 4.4);
34 std::array<double, 3> const array = {3.3, 4.4, 5.5};
35 assert(std::get<0>(array) == 3.3);
36 assert(std::get<1>(array) == 4.4);
37 assert(std::get<2>(array) == 5.5);
40 std::array<double, 1> const array = {3.3};
41 static_assert(std::is_same<double const&, decltype(std::get<0>(array))>::value, "");
44 return true;
47 int main(int, char**)
49 tests();
50 #if TEST_STD_VER >= 14
51 static_assert(tests(), "");
52 #endif
53 return 0;