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