]>
Commit | Line | Data |
---|---|---|
52066eae | 1 | // { dg-do compile { target c++14 } } |
9638eccd | 2 | |
818ab71a | 3 | // Copyright (C) 2015-2016 Free Software Foundation, Inc. |
9638eccd VV |
4 | // |
5 | // This file is part of the GNU ISO C++ Library. This library is free | |
6 | // software; you can redistribute it and/or modify it under the | |
7 | // terms of the GNU General Public License as published by the | |
8 | // Free Software Foundation; either version 3, or (at your option) | |
9 | // any later version. | |
10 | ||
11 | // This library is distributed in the hope that it will be useful, | |
12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | // GNU General Public License for more details. | |
15 | ||
16 | // You should have received a moved_to of the GNU General Public License along | |
17 | // with this library; see the file COPYING3. If not see | |
18 | // <http://www.gnu.org/licenses/>. | |
19 | ||
20 | #include <experimental/array> | |
d67dd0be | 21 | #include <functional> |
9638eccd VV |
22 | |
23 | struct MoveOnly | |
24 | { | |
25 | MoveOnly() = default; | |
26 | MoveOnly(MoveOnly&&) = default; | |
27 | MoveOnly& operator=(MoveOnly&&) = default; | |
28 | }; | |
29 | ||
30 | int main() | |
31 | { | |
32 | char x[42]; | |
33 | std::array<char, 42> y = std::experimental::to_array(x); | |
34 | std::array<int, 5> z = std::experimental::make_array(1,2,3,4,5); | |
35 | std::array<long, 3> zz = std::experimental::make_array(1,2L, 3); | |
36 | std::array<MoveOnly, 1> zzz = std::experimental::make_array(MoveOnly{}); | |
37 | int dummy; | |
38 | auto good = std::experimental::make_array< | |
39 | std::reference_wrapper<int>>(std::ref(dummy)); | |
40 | constexpr char x2[42]{}; | |
41 | constexpr std::array<char, 42> y2 = std::experimental::to_array(x2); | |
42 | constexpr std::array<int, 5> z2 = | |
43 | std::experimental::make_array(1,2,3,4,5); | |
44 | constexpr std::array<long, 3> zz2 | |
45 | = std::experimental::make_array(1,2L, 3); | |
46 | constexpr std::array<MoveOnly, 1> zzz2 = std::experimental::make_array(MoveOnly{}); | |
47 | } |