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