Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/concepts-alias5.C

raw
1 // PR c++/93377
2 // { dg-do compile { target c++20 } }
3
4 struct empty
5 {};
6
7 template <typename c>
8 c value;
9
10 template <typename c>
11 auto func(value<c>);
12
13 template <typename, typename...>
14 struct alignment_algorithm;
15
16 template <typename... args_t>
17 struct select
18 {
19 template <typename algorithm_t, typename... _args_t>
20 decltype(algorithm_t()(func<_args_t>...)) choose();
21
22 template <typename...>
23 static empty choose();
24
25 using type = decltype(choose<alignment_algorithm<int>, args_t...>());
26 };
27
28 template <typename, typename... args_t>
29 struct select_algorithm : select<args_t...>
30 {};
31
32 template <typename, typename = void> struct maybe_value { int value; };
33
34 template <typename cn>
35 struct maybe_value<cn, typename cn::sfinae>;
36
37 struct function
38 {
39 template <typename algorithm_t,
40 typename = decltype(
41 maybe_value<select_algorithm<algorithm_t, int>>::value)>
42 function(algorithm_t);
43 };
44
45 template <typename>
46 struct alignment_configuration_traits
47 {
48 static constexpr bool is_vectorised = 0;
49 };
50
51 template <typename config_t, typename...>
52 struct alignment_algorithm
53 {
54 using traits_t = alignment_configuration_traits<config_t>;
55 template <typename indexed_sequence_pairs_t>
56 void operator()(indexed_sequence_pairs_t) requires traits_t::is_vectorised;
57 };
58
59 int main()
60 {
61 function{alignment_algorithm<int>{}};
62 }