]>
Commit | Line | Data |
---|---|---|
1 | // { dg-do compile { target c++20 } } | |
2 | // FIXME [!HOSTED]: avoidable std::allocator usage | |
3 | // { dg-require-effective-target hosted } | |
4 | // { dg-add-options no_pch } | |
5 | // | |
6 | // Copyright (C) 2019-2024 Free Software Foundation, Inc. | |
7 | // | |
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) | |
12 | // any later version. | |
13 | // | |
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. | |
18 | // | |
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/>. | |
22 | ||
23 | #include <tuple> | |
24 | ||
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>" | |
29 | #endif | |
30 | ||
31 | #include <memory> | |
32 | ||
33 | const std::allocator<int> alloc{}; | |
34 | ||
35 | constexpr bool | |
36 | test_tuple() | |
37 | { | |
38 | auto ok = true; | |
39 | ||
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)); | |
45 | ||
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)); | |
49 | ||
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)); | |
53 | ||
54 | return ok; | |
55 | } | |
56 | ||
57 | static_assert(test_tuple()); |