| 1 |
// PR c++/97399 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template <bool> struct enable_if_t {}; |
| 5 |
|
| 6 |
struct tmp { |
| 7 |
template <class> static constexpr bool is_integral(); |
| 8 |
template <class T> static auto f() |
| 9 |
-> enable_if_t<tmp::is_integral<T>()>; |
| 10 |
template <class T> friend auto g(tmp, T) |
| 11 |
-> enable_if_t<!tmp::is_integral<T>()>; |
| 12 |
}; |
| 13 |
|
| 14 |
template <class> constexpr bool tmp::is_integral() { return true; } |
| 15 |
|
| 16 |
template <class T> auto tmp::f() |
| 17 |
-> enable_if_t<tmp::is_integral<T>()> { return {}; } |
| 18 |
|
| 19 |
int main() |
| 20 |
{ |
| 21 |
tmp::f<int>(); |
| 22 |
g(tmp{}, 0); |
| 23 |
} |