gcc/testsuite/gdc.test/compilable/issue9884.d
raw| 1 | // https://issues.dlang.org/show_bug.cgi?id=9884 |
| 2 | module issue9884; |
| 3 | |
| 4 | const(int)[] data; |
| 5 | |
| 6 | static this() |
| 7 | { |
| 8 | data = new int[10]; |
| 9 | foreach (ref x; data) x = 1; |
| 10 | data[] = 1; |
| 11 | } |
| 12 | |
| 13 | struct Foo |
| 14 | { |
| 15 | static const(int)[] data; |
| 16 | |
| 17 | static this() |
| 18 | { |
| 19 | this.data = new int[10]; |
| 20 | foreach (ref x; this.data) x = 1; |
| 21 | this.data[] = 1; |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | void main() {} |