gcc/testsuite/gdc.test/fail_compilation/test22686.d
raw| 1 | // https://issues.dlang.org/show_bug.cgi?id=22686 |
| 2 | |
| 3 | /* |
| 4 | TEST_OUTPUT: |
| 5 | --- |
| 6 | fail_compilation/test22686.d(15): Error: `this` is only defined in non-static member functions, not `create` |
| 7 | --- |
| 8 | */ |
| 9 | |
| 10 | struct S |
| 11 | { |
| 12 | int[] data; |
| 13 | static auto create() |
| 14 | { |
| 15 | auto self = &this; |
| 16 | return { |
| 17 | assert(data.length); |
| 18 | return self; |
| 19 | }; |
| 20 | } |
| 21 | } |