Showing with 28 additions and 0 deletions.
  1. +28 −0 test/fail_compilation/diag12487.d
28 changes: 28 additions & 0 deletions test/fail_compilation/diag12487.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,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);
}