]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gdc.test/fail_compilation/ctfe13612.d
Add D front-end, libphobos library, and D2 testsuite.
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / fail_compilation / ctfe13612.d
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/ctfe13612.d(15): Error: function ctfe13612.S.recurse CTFE recursion limit exceeded
5 fail_compilation/ctfe13612.d(20): called from here: s.recurse()
6 fail_compilation/ctfe13612.d(15): 1000 recursive calls to function recurse
7 fail_compilation/ctfe13612.d(23): called from here: (new S).recurse()
8 fail_compilation/ctfe13612.d(23): while evaluating: `static assert((new S).recurse())`
9 ---
10 */
11
12 class S
13 {
14 int x;
15 int recurse()
16 {
17 S s;
18 assert(!x); // Error: class 'this' is null and cannot be dereferenced
19 s = new S();
20 return s.recurse();
21 }
22 }
23 static assert(new S().recurse());