gcc/testsuite/gdc.test/fail_compilation/fail280.d
raw| 1 | // https://issues.dlang.org/show_bug.cgi?id=2920 |
| 2 | // recursive templates blow compiler stack |
| 3 | // template_17_A. |
| 4 | /* |
| 5 | TEST_OUTPUT: |
| 6 | --- |
| 7 | fail_compilation/fail280.d(13): Error: template instance `fail280.t!500` recursive expansion exceeded allowed nesting limit |
| 8 | --- |
| 9 | */ |
| 10 | |
| 11 | template t(int i) |
| 12 | { |
| 13 | const int x = t!(i + 1).x; |
| 14 | } |
| 15 | |
| 16 | void main() |
| 17 | { |
| 18 | int i = t!(0).x; |
| 19 | } |