[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / libcxx / test / std / containers / sequences / array / array.tuple / get_const_rv.pass.cpp
blobce8fc4fd3651c1fd0a1f0ec2d105a5e5d7ed9533
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 // UNSUPPORTED: c++98, c++03
15 #include <array>
16 #include <memory>
17 #include <type_traits>
18 #include <utility>
19 #include <cassert>
21 #include "test_macros.h"
23 // std::array is explicitly allowed to be initialized with A a = { init-list };.
24 // Disable the missing braces warning for this reason.
25 #include "disable_missing_braces_warning.h"
27 int main(int, char**)
31 typedef std::unique_ptr<double> T;
32 typedef std::array<T, 1> C;
33 const C c = {std::unique_ptr<double>(new double(3.5))};
34 static_assert(std::is_same<const T&&, decltype(std::get<0>(std::move(c)))>::value, "");
35 static_assert(noexcept(std::get<0>(std::move(c))), "");
36 const T&& t = std::get<0>(std::move(c));
37 assert(*t == 3.5);
40 #if TEST_STD_VER > 11
42 typedef double T;
43 typedef std::array<T, 3> C;
44 constexpr const C c = {1, 2, 3.5};
45 static_assert(std::get<0>(std::move(c)) == 1, "");
46 static_assert(std::get<1>(std::move(c)) == 2, "");
47 static_assert(std::get<2>(std::move(c)) == 3.5, "");
49 #endif
51 return 0;