]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/20_util/tuple/cons/constexpr_allocator_arg_t.cc
1 // { dg-options "-std=gnu++2a" }
2 // { dg-do compile { target c++2a } }
3 // FIXME [!HOSTED]: avoidable std::allocator usage
4 // { dg-require-effective-target hosted }
6 // Copyright (C) 2019-2022 Free Software Foundation, Inc.
8 // This file is part of the GNU ISO C++ Library. This library is free
9 // software; you can redistribute it and/or modify it under the
10 // terms of the GNU General Public License as published by the
11 // Free Software Foundation; either version 3, or (at your option)
14 // This library is distributed in the hope that it will be useful,
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 // GNU General Public License for more details.
19 // You should have received a copy of the GNU General Public License along
20 // with this library; see the file COPYING3. If not see
21 // <http://www.gnu.org/licenses/>.
25 #ifndef __cpp_lib_constexpr_tuple
26 # error "Feature test macro for constexpr allocator constructors is missing in <tuple>"
27 #elif __cpp_lib_constexpr_tuple < 201811L
28 # error "Feature test macro for constexpr allocator constructors has wrong value in <tuple>"
33 const std::allocator
<int> alloc
{};
40 std::tuple
<int, double, double> ta(std::allocator_arg
, alloc
);
41 std::tuple
<int, double, double> tb(std::allocator_arg
, alloc
, 0, 3.456, 6.789);
42 std::tuple
<int, double, double> tc(std::allocator_arg
, alloc
, 0, 3.456f
, 6.789f
);
43 std::tuple
<int, double, double> td(std::allocator_arg
, alloc
, tb
);
44 std::tuple
<int, double, double> te(std::allocator_arg
, alloc
, std::move(tb
));
46 std::tuple
<int, float, float> tf(std::allocator_arg
, alloc
, 0, 3.456f
, 6.789f
);
47 std::tuple
<int, double, double> tg(std::allocator_arg
, alloc
, tf
);
48 std::tuple
<int, double, double> th(std::allocator_arg
, alloc
, std::move(tf
));
50 std::pair
<int, float> pf(12, 3.142f
);
51 std::tuple
<int, double> ti(std::allocator_arg
, alloc
, pf
);
52 std::tuple
<int, double> tj(std::allocator_arg
, alloc
, std::move(pf
));
57 static_assert(test_tuple());