1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/ice9806.d(12): Error: undefined identifier `undefined_expr`
5 fail_compilation/ice9806.d(17): Error: template instance `ice9806.S1!()` error instantiating
6 fail_compilation/ice9806.d(13): Error: undefined identifier `undefined_expr`
7 fail_compilation/ice9806.d(19): Error: template instance `ice9806.C1!()` error instantiating
8 fail_compilation/ice9806.d(14): Error: undefined identifier `undefined_expr`
9 fail_compilation/ice9806.d(21): Error: template instance `ice9806.I1!()` error instantiating
10 ---
11 */
S1()12 struct S1() { enum x = undefined_expr; }
C1()13 class  C1() { enum x = undefined_expr; }
I1()14 class  I1() { enum x = undefined_expr; }
test1()15 void test1() {
16     static assert(!is(typeof(S1!().x)));
17     auto sx = S1!().x;
18     static assert(!is(typeof(C1!().x)));
19     auto cx = C1!().x;
20     static assert(!is(typeof(I1!().x)));
21     auto ix = I1!().x;
22 }
23 
24 // --------
25 /*
26 TEST_OUTPUT:
27 ---
28 fail_compilation/ice9806.d(36): Error: undefined identifier `undefined_expr`
29 fail_compilation/ice9806.d(44): Error: template instance `ice9806.S2!()` error instantiating
30 fail_compilation/ice9806.d(37): Error: undefined identifier `undefined_expr`
31 fail_compilation/ice9806.d(46): Error: template instance `ice9806.C2!()` error instantiating
32 fail_compilation/ice9806.d(38): Error: undefined identifier `undefined_expr`
33 fail_compilation/ice9806.d(48): Error: template instance `ice9806.I2!()` error instantiating
34 ---
35 */
foo2()36 int foo2()() { return undefined_expr; }
bar2()37 int bar2()() { return undefined_expr; }
baz2()38 int baz2()() { return undefined_expr; }
S2()39 struct S2() { enum x = foo2(); }
C2()40 class  C2() { enum x = bar2(); }
I2()41 class  I2() { enum x = baz2(); }
test2()42 void test2() {
43     static assert(!is(typeof(S2!().x)));
44     auto sx = S2!().x;
45     static assert(!is(typeof(C2!().x)));
46     auto cx = C2!().x;
47     static assert(!is(typeof(I2!().x)));
48     auto ix = I2!().x;
49 }
50