aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/decltype64.C
blob: 46d18594c949a5d0d90a021999714b80ae3414dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// PR c++/53401
// { dg-do compile { target c++11 } }

template<int I>
struct index
{};

constexpr int recursive_impl(index<0u>)
{
  return 0;
}

template<int N>
constexpr auto recursive_impl(index<N>)
  -> decltype(recursive_impl(index<N - 1>()))  // { dg-error "depth" }
{
  return recursive_impl(index<N - 1>());
}

template<int N>
constexpr auto recursive()
  -> decltype(recursive_impl(index<N>()))
{
  return recursive_impl(index<N>());
}

void f(int i)
{
  recursive<1>();   // { dg-message "from here" }
}

// { dg-prune-output "compilation terminated" }