1 /* TEST_OUTPUT:
2 ---
3 fail_compilation/fail17491.d(24): Error: (S17491).init is not an lvalue
4 fail_compilation/fail17491.d(25): Error: S17491(0) is not an lvalue
5 fail_compilation/fail17491.d(27): Error: constant S17491(0).field is not an lvalue
6 fail_compilation/fail17491.d(28): Error: constant *&S17491(0).field is not an lvalue
7 fail_compilation/fail17491.d(33): Error: S17491(0) is not an lvalue
8 fail_compilation/fail17491.d(34): Error: S17491(0) is not an lvalue
9 fail_compilation/fail17491.d(36): Error: constant S17491(0).field is not an lvalue
10 fail_compilation/fail17491.d(37): Error: constant *&S17491(0).field is not an lvalue
11 ---
12 */
13 
14 // https://issues.dlang.org/show_bug.cgi?id=17491
15 
16 struct S17491
17 {
18     int field;
19     static int var;
20 }
21 
test17491()22 void test17491()
23 {
24     S17491.init = S17491(42);       // NG
25     *&S17491.init = S17491(42);     // NG
26 
27     S17491.init.field = 42;         // NG
28     *&S17491.init.field = 42;       // Should be NG
29 
30     S17491.init.var = 42;           // OK
31     *&S17491.init.var = 42;         // OK
32 
33     S17491(0) = S17491(42);         // NG
34     *&S17491(0) = S17491(42);       // NG
35 
36     S17491(0).field = 42;           // NG
37     *&S17491(0).field = 42;         // Should be NG
38 
39     S17491(0).var = 42;             // OK
40     *&S17491(0).var = 42;           // OK
41 }
42