| 1 |
// PR c++/53401 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
|
| 4 |
template<int I> |
| 5 |
struct index |
| 6 |
{}; |
| 7 |
|
| 8 |
constexpr int recursive_impl(const index<0u>&) |
| 9 |
{ |
| 10 |
return 0; |
| 11 |
} |
| 12 |
|
| 13 |
template<int N> |
| 14 |
constexpr auto recursive_impl(index<N>) |
| 15 |
-> decltype(recursive_impl(index<N - 1>())) // { dg-error "depth" } |
| 16 |
{ |
| 17 |
return recursive_impl(index<N - 1>()); |
| 18 |
} |
| 19 |
|
| 20 |
template<int N> |
| 21 |
constexpr auto recursive() |
| 22 |
-> decltype(recursive_impl(index<N>())) |
| 23 |
{ |
| 24 |
return recursive_impl(index<N>()); |
| 25 |
} |
| 26 |
|
| 27 |
void f(int i) |
| 28 |
{ |
| 29 |
recursive<1>(); // { dg-message "from here" } |
| 30 |
} |
| 31 |
|
| 32 |
// { dg-prune-output "compilation terminated" } |