]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/experimental/array/make_array.cc
Use effective-target instead of -std options
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / experimental / array / make_array.cc
1 // { dg-do compile { target c++14 } }
2
3 // Copyright (C) 2015-2016 Free Software Foundation, Inc.
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>
21
22 struct MoveOnly
23 {
24 MoveOnly() = default;
25 MoveOnly(MoveOnly&&) = default;
26 MoveOnly& operator=(MoveOnly&&) = default;
27 };
28
29 int main()
30 {
31 char x[42];
32 std::array<char, 42> y = std::experimental::to_array(x);
33 std::array<int, 5> z = std::experimental::make_array(1,2,3,4,5);
34 std::array<long, 3> zz = std::experimental::make_array(1,2L, 3);
35 std::array<MoveOnly, 1> zzz = std::experimental::make_array(MoveOnly{});
36 int dummy;
37 auto good = std::experimental::make_array<
38 std::reference_wrapper<int>>(std::ref(dummy));
39 constexpr char x2[42]{};
40 constexpr std::array<char, 42> y2 = std::experimental::to_array(x2);
41 constexpr std::array<int, 5> z2 =
42 std::experimental::make_array(1,2,3,4,5);
43 constexpr std::array<long, 3> zz2
44 = std::experimental::make_array(1,2L, 3);
45 constexpr std::array<MoveOnly, 1> zzz2 = std::experimental::make_array(MoveOnly{});
46 }