111
|
1 // PR c++/66937
|
|
2 // { dg-options "-std=c++17 -fconcepts" }
|
|
3
|
|
4 #include <tuple>
|
|
5
|
|
6 namespace detail
|
|
7 {
|
|
8 template<typename T, template<typename...> class Sink>
|
|
9 struct copy_tuple_args_impl;
|
|
10
|
|
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 };
|
|
16 }
|
|
17
|
|
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;
|
|
22
|
|
23 // A concept of a column
|
|
24 template <typename T>
|
|
25 concept bool Column()
|
|
26 {
|
|
27 return requires()
|
|
28 {
|
|
29 typename T::_name_t;
|
|
30 };
|
|
31 }
|
|
32
|
|
33 // column_list is constrained to Column arguments
|
|
34 template<Column... C>
|
|
35 struct column_list
|
|
36 {
|
|
37 };
|
|
38
|
|
39 // Here are some columns
|
|
40 struct A
|
|
41 {
|
|
42 using _name_t = int;
|
|
43 };
|
|
44
|
|
45 struct B
|
|
46 {
|
|
47 using _name_t = int;
|
|
48 };
|
|
49
|
|
50
|
|
51 int main()
|
|
52 {
|
|
53 using ColumnTuple = std::tuple<A, B>;
|
|
54 using ColumnList = copy_tuple_args<ColumnTuple, column_list>; // This fails, but should not
|
|
55 }
|
|
56
|