summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/diag12487.d
blob: b9193231e8aa0842cdc5c31b41a3a0ed813d5fe1 (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
/*
TEST_OUTPUT:
---
fail_compilation/diag12487.d(15): Error: recursive expansion of template instance 'diag12487.recTemplate!int'
fail_compilation/diag12487.d(25): Error: template instance diag12487.recTemplate!int error instantiating
fail_compilation/diag12487.d(18): Error: function diag12487.recFunction CTFE recursion limit exceeded
fail_compilation/diag12487.d(20):        called from here: recFunction(i)
fail_compilation/diag12487.d(18):        1000 recursive calls to function recFunction
fail_compilation/diag12487.d(27):        called from here: recFunction(0)
---
*/

template recTemplate(T)
{
    enum bool recTemplate = recTemplate!T;
}

bool recFunction(int i)
{
    return recFunction(i);
}

void main()
{
    enum bool value1 = recTemplate!int;

    enum bool value2 = recFunction(0);
}