| 1 |
// PR c++/98077 |
| 2 |
// { dg-do compile { target c++17 } } |
| 3 |
|
| 4 |
template<class R> |
| 5 |
struct function { |
| 6 |
template<class T> function(T); |
| 7 |
using type = R; |
| 8 |
}; |
| 9 |
|
| 10 |
template<class T> function(T) -> function<decltype(T()())>; |
| 11 |
|
| 12 |
template<class T> |
| 13 |
struct CallableTrait; |
| 14 |
|
| 15 |
template<class R> |
| 16 |
struct CallableTrait<function<R>> { using ReturnType = R; }; |
| 17 |
|
| 18 |
template<class F> |
| 19 |
using CallableTraitT = CallableTrait<decltype(function{F()})>; |
| 20 |
|
| 21 |
template<class F> |
| 22 |
using ReturnType = typename CallableTraitT<F>::ReturnType; |
| 23 |
|
| 24 |
using type = ReturnType<int(*)()>; |
| 25 |
using type = int; |