PR c++/86728 - C variadic generic lambda.
[official-gcc.git] / gcc / testsuite / g++.dg / concepts / template-template-parm1.C
blobe828db96a8153836e150e3c7e29218bceeee6f20
1 // PR c++/66937
2 // { dg-options "-std=c++17 -fconcepts" }
4 #include <tuple>
6 namespace detail
8   template<typename T, template<typename...> class Sink>
9   struct copy_tuple_args_impl;
11   template<typename... Args, template<typename...> class Sink>
12   struct copy_tuple_args_impl<std::tuple<Args...>, Sink>
13   {
14     using type = Sink<Args...>;
15   };
18 // copy_tuple_args copies the template arguments of a tuple into another template
19 // copy_tuple_args does not care about constraints whatsoever.
20 template<typename Tuple, template<typename...> class Sink>
21 using copy_tuple_args = typename detail::copy_tuple_args_impl<Tuple, Sink>::type;
23 // A concept of a column
24 template <typename T>
25 concept bool Column()
27   return requires()
28     {
29       typename T::_name_t;
30     };
33 // column_list is constrained to Column arguments
34 template<Column... C>
35 struct column_list
39 // Here are some columns
40 struct A
42   using _name_t = int;
45 struct B
47   using _name_t = int;
51 int main()
53   using ColumnTuple = std::tuple<A, B>;
54   using ColumnList = copy_tuple_args<ColumnTuple, column_list>; // This fails, but should not