1 // { dg-options "-std=gnu++2a" }
2 // { dg-do compile { target c++2a } }
3 //
4 // Copyright (C) 2019-2021 Free Software Foundation, Inc.
5 //
6 // This file is part of the GNU ISO C++ Library.  This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
10 // any later version.
11 //
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3.  If not see
19 // <http://www.gnu.org/licenses/>.
20 
21 #include <tuple>
22 
23 #ifndef __cpp_lib_constexpr_tuple
24 # error "Feature test macro for constexpr allocator constructors is missing in <tuple>"
25 #elif __cpp_lib_constexpr_tuple < 201811L
26 # error "Feature test macro for constexpr allocator constructors has wrong value in <tuple>"
27 #endif
28 
29 #include <memory>
30 
31 const std::allocator<int> alloc{};
32 
33 constexpr bool
test_tuple()34 test_tuple()
35 {
36   auto ok = true;
37 
38   std::tuple<int, double, double> ta(std::allocator_arg, alloc);
39   std::tuple<int, double, double> tb(std::allocator_arg, alloc, 0, 3.456, 6.789);
40   std::tuple<int, double, double> tc(std::allocator_arg, alloc, 0, 3.456f, 6.789f);
41   std::tuple<int, double, double> td(std::allocator_arg, alloc, tb);
42   std::tuple<int, double, double> te(std::allocator_arg, alloc, std::move(tb));
43 
44   std::tuple<int, float, float> tf(std::allocator_arg, alloc, 0, 3.456f, 6.789f);
45   std::tuple<int, double, double> tg(std::allocator_arg, alloc, tf);
46   std::tuple<int, double, double> th(std::allocator_arg, alloc, std::move(tf));
47 
48   std::pair<int, float> pf(12, 3.142f);
49   std::tuple<int, double> ti(std::allocator_arg, alloc, pf);
50   std::tuple<int, double> tj(std::allocator_arg, alloc, std::move(pf));
51 
52   return ok;
53 }
54 
55 static_assert(test_tuple());
56