gcc/testsuite/gdc.test/compilable/named_argumens_struct.d
raw| 1 | |
| 2 | struct S |
| 3 | { |
| 4 | string name; |
| 5 | int x; |
| 6 | int y; |
| 7 | } |
| 8 | |
| 9 | |
| 10 | immutable S s = S(x: 2, 3, name: "boo"); |
| 11 | |
| 12 | static assert(s.x == 2); |
| 13 | static assert(s.y == 3); |
| 14 | static assert(s.name == "boo"); |
| 15 | |
| 16 | union U |
| 17 | { |
| 18 | float f; |
| 19 | int i; |
| 20 | } |
| 21 | |
| 22 | immutable U u = U(i: 2); |
| 23 | |
| 24 | static assert(u.i == 2); |