Debian Codegraph @

gcc/testsuite/g++.dg/cpp1z/class-deduction102b.C

raw
1 // PR c++/98077
2 // { dg-do compile { target c++17 } }
3 // A variant of class-deduction102.C where the template placeholder is a template
4 // template parameter and ReturnType has more levels than CallableTraitT.
5
6 template<class R>
7 struct function {
8 template<class T> function(T);
9 using type = R;
10 };
11
12 template<class T> function(T) -> function<decltype(T()())>;
13
14 template<class T>
15 struct CallableTrait;
16
17 template<class R>
18 struct CallableTrait<function<R>> { using ReturnType = R; };
19
20 template<class F, template<class> class Tmpl>
21 using CallableTraitT = CallableTrait<decltype(Tmpl{F()})>;
22
23 template<class>
24 struct A {
25 template<class F, template<class> class Tmpl>
26 using ReturnType = typename CallableTraitT<F, Tmpl>::ReturnType;
27 };
28
29 using type = A<int>::ReturnType<int(*)(), function>;
30 using type = int;