]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gdc.test/fail_compilation/fail351.d
d: Import dmd b8384668f, druntime e6caaab9, phobos 5ab9ad256 (v2.098.0-beta.1)
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail351.d
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/fail351.d(14): Error: expression `this.num[index]` of type `immutable(uint)` is not implicitly convertible to return type `ref uint`
5 ---
6 */
7
8 // https://issues.dlang.org/show_bug.cgi?id=2780
9
10 struct Immutable {
11 immutable uint[2] num;
12
13 ref uint opIndex(size_t index) immutable return {
14 return num[index];
15 }
16 }
17
18 void main() {
19 immutable Immutable foo;
20 //foo[0]++;
21 }