| 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. |
| 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 F, template<class> class Tmpl> |
| 24 |
using ReturnType = typename CallableTraitT<F, Tmpl>::ReturnType; |
| 25 |
|
| 26 |
using type = ReturnType<int(*)(), function>; |
| 27 |
using type = int; |