Skip to content

Commit

Permalink
fix Issue 12487 - DMD correctly reports excessive CTFE recursion, but…
Browse files Browse the repository at this point in the history
… not template recursion
  • Loading branch information
9rnsr committed Oct 4, 2015
1 parent ae922d8 commit 193ad12
Showing 1 changed file with 28 additions and 0 deletions.
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);
}

0 comments on commit 193ad12

Please sign in to comment.