]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gdc.test/fail_compilation/fail17491.d
d: Import dmd b8384668f, druntime e6caaab9, phobos 5ab9ad256 (v2.098.0-beta.1)
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail17491.d
1 /* TEST_OUTPUT:
2 ---
3 fail_compilation/fail17491.d(22): Error: `(S17491).init` is not an lvalue and cannot be modified
4 fail_compilation/fail17491.d(23): Error: `S17491(0)` is not an lvalue and cannot be modified
5 fail_compilation/fail17491.d(25): Error: `S17491(0).field` is not an lvalue and cannot be modified
6 fail_compilation/fail17491.d(26): Error: `S17491(0).field` is not an lvalue and cannot be modified
7 fail_compilation/fail17491.d(31): Error: `S17491(0)` is not an lvalue and cannot be modified
8 fail_compilation/fail17491.d(32): Error: `S17491(0)` is not an lvalue and cannot be modified
9 fail_compilation/fail17491.d(34): Error: `S17491(0).field` is not an lvalue and cannot be modified
10 fail_compilation/fail17491.d(35): Error: `S17491(0).field` is not an lvalue and cannot be modified
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 }