-
-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix Issue 12487 - DMD correctly reports excessive CTFE recursion, but…
… not template recursion
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
| } |