]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/tuple/creation_functions/tuple_cat.cc
1 // { dg-do run { target c++11 } }
3 // Copyright (C) 2011-2020 Free Software Foundation, Inc.
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)
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.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
25 static_assert(std::is_same
<decltype(std::tuple_cat()),
26 std::tuple
<>>::value
, "Error");
27 static_assert(std::is_same
<decltype(std::tuple_cat
28 (std::declval
<std::tuple
<>>())),
29 std::tuple
<>>::value
, "Error");
30 static_assert(std::is_same
<decltype(std::tuple_cat
31 (std::declval
<std::tuple
<>&>())),
32 std::tuple
<>>::value
, "Error");
33 static_assert(std::is_same
<decltype(std::tuple_cat
34 (std::declval
<const std::tuple
<>>())),
35 std::tuple
<>>::value
, "Error");
36 static_assert(std::is_same
<decltype(std::tuple_cat
37 (std::declval
<const std::tuple
<>&>())),
38 std::tuple
<>>::value
, "Error");
39 static_assert(std::is_same
<decltype(std::tuple_cat
40 (std::declval
<std::pair
<int, bool>>())),
41 std::tuple
<int, bool>>::value
, "Error");
42 static_assert(std::is_same
<decltype(std::tuple_cat
43 (std::declval
<std::pair
<int, bool>&>())),
44 std::tuple
<int, bool>>::value
, "Error");
45 static_assert(std::is_same
<decltype
46 (std::tuple_cat(std::declval
<const std::pair
<int, bool>>())),
47 std::tuple
<int, bool>>::value
, "Error");
48 static_assert(std::is_same
<decltype
49 (std::tuple_cat(std::declval
<const std::pair
<int, bool>&>())),
50 std::tuple
<int, bool>>::value
, "Error");
51 static_assert(std::is_same
<decltype
52 (std::tuple_cat(std::declval
<std::array
<int, 3>>())),
53 std::tuple
<int, int, int>>::value
, "Error");
54 static_assert(std::is_same
<decltype
55 (std::tuple_cat(std::declval
<std::array
<int, 3>&>())),
56 std::tuple
<int, int, int>>::value
, "Error");
57 static_assert(std::is_same
<decltype
58 (std::tuple_cat(std::declval
<const std::array
<int, 3>>())),
59 std::tuple
<int, int, int>>::value
, "Error");
60 static_assert(std::is_same
<decltype
61 (std::tuple_cat(std::declval
<const std::array
<int, 3>&>())),
62 std::tuple
<int, int, int>>::value
, "Error");
63 static_assert(std::is_same
<decltype
65 (std::declval
<std::tuple
<>>(), std::declval
<std::tuple
<>>())),
66 std::tuple
<>>::value
, "Error");
67 static_assert(std::is_same
<decltype
69 (std::declval
<std::tuple
<>>(), std::declval
<std::tuple
<>>(),
70 std::declval
<std::tuple
<>>())), std::tuple
<>>::value
, "Error");
71 static_assert(std::is_same
<decltype
73 (std::declval
<std::tuple
<>>(),
74 std::declval
<std::array
<char, 0>>(),
75 std::declval
<std::array
<int, 0>>(),
76 std::declval
<std::tuple
<>>())), std::tuple
<>>::value
, "Error");
77 static_assert(std::is_same
<decltype
79 (std::declval
<std::tuple
<int>>(),
80 std::declval
<std::tuple
<double>>())),
81 std::tuple
<int, double>>::value
, "Error");
82 static_assert(std::is_same
<decltype
84 (std::declval
<std::tuple
<int>>(),
85 std::declval
<std::tuple
<double>>(),
86 std::declval
<std::tuple
<const long&>>())),
87 std::tuple
<int, double, const long&>>::value
, "Error");
88 static_assert(std::is_same
<decltype
90 (std::declval
<std::array
<wchar_t, 3>&>(),
91 std::declval
<std::tuple
<double>>(),
92 std::declval
<std::tuple
<>>(),
93 std::declval
<std::tuple
<unsigned&>>(),
94 std::declval
<std::pair
<bool, std::nullptr_t
>>())),
95 std::tuple
<wchar_t, wchar_t, wchar_t,
96 double, unsigned&, bool, std::nullptr_t
>
102 std::tuple_cat(std::tuple
<>{ });
103 std::tuple_cat(std::tuple
<>{ }, std::tuple
<>{ });
104 std::array
<int, 3> a3
;
106 std::pair
<double, bool> pdb
;
107 std::tuple
<unsigned, float, std::nullptr_t
, void*> t
;
111 std::tuple
<int&, double&, int*&> to
{i
, d
, pi
};
114 std::tuple_cat(to
, to
);
115 std::tuple_cat(a3
, pdb
);
116 std::tuple_cat(a3
, pdb
, t
);
117 std::tuple_cat(a3
, pdb
, t
, a3
);
118 std::tuple_cat(a3
, pdb
, t
, a3
, pdb
, t
);
120 static_assert(std::is_same
<decltype
121 (std::tuple_cat(a3
, pdb
, t
, a3
, pdb
, t
)),
122 std::tuple
<int, int, int, double, bool,
123 unsigned, float, std::nullptr_t
, void*,
124 int, int, int, double, bool, unsigned,
125 float, std::nullptr_t
, void*>
128 std::tuple_cat(std::tuple
<int, char, void*>{}, to
, a3
,
129 std::tuple
<>{}, std::pair
<float,
130 std::nullptr_t
>{}, pdb
, to
);