]>
Commit | Line | Data |
---|---|---|
3fe2ddae VV |
1 | // { dg-do compile { target c++11 } } |
2 | ||
a945c346 | 3 | // Copyright (C) 2016-2024 Free Software Foundation, Inc. |
3fe2ddae VV |
4 | // |
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) | |
9 | // any later version. | |
10 | ||
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. | |
15 | ||
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/>. | |
19 | ||
20 | #include <tuple> | |
21 | ||
22 | // This testcase instantiates a tuple with an incomplete type. | |
23 | // That is undefined behavior, but our tuple implementation manages | |
24 | // to cope with this particular case. The attempt to provide | |
25 | // a tuple implementation that yields the right result for | |
26 | // traits like is_copy_constructible and is_move_constructible as | |
27 | // per LWG 2729 results in ill-formed copy/move constructors being | |
28 | // generated for a tuple that contains an incomplete type. | |
29 | // Once we get concepts, we can solve that problem much easier. | |
30 | ||
31 | template <typename... Args> struct execution_context | |
32 | { | |
33 | typedef std::tuple<Args...> args_tpl_t; | |
34 | typedef std::tuple<execution_context, typename std::decay<Args>::type...> | |
35 | ret_tpl_t; | |
36 | execution_context(); | |
37 | execution_context(execution_context &&); | |
38 | ret_tpl_t operator()() { | |
39 | args_tpl_t data; | |
40 | return tuple_cat(std::forward_as_tuple(execution_context()), data); | |
41 | } | |
42 | }; | |
43 | ||
44 | void fn1() | |
45 | { | |
46 | execution_context<int> cc; | |
47 | cc(); | |
48 | } | |
49 |