[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / libcxx / test / std / containers / sequences / array / begin.pass.cpp
blob7b26d231dbdd91e3e9f264e58d98ff4cf4e14fba
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 // iterator begin();
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 struct NoDefault {
23 NoDefault(int) {}
27 int main(int, char**)
30 typedef double T;
31 typedef std::array<T, 3> C;
32 C c = {1, 2, 3.5};
33 C::iterator i;
34 i = c.begin();
35 assert(*i == 1);
36 assert(&*i == c.data());
37 *i = 5.5;
38 assert(c[0] == 5.5);
41 typedef NoDefault T;
42 typedef std::array<T, 0> C;
43 C c = {};
44 C::iterator ib, ie;
45 ib = c.begin();
46 ie = c.end();
47 assert(ib == ie);
48 LIBCPP_ASSERT(ib != nullptr);
49 LIBCPP_ASSERT(ie != nullptr);
52 return 0;