gcc/testsuite/gdc.test/fail_compilation/fail11503c.d
raw| 1 | /* |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/fail11503c.d(19): Error: cannot implicitly convert expression `d.filename()` of type `const(char)[]` to `string` |
| 5 | --- |
| 6 | */ |
| 7 | struct Data |
| 8 | { |
| 9 | char[256] buffer; |
| 10 | @property const(char)[] filename() const pure nothrow return |
| 11 | { |
| 12 | return buffer[]; |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | void main() |
| 17 | { |
| 18 | Data d; |
| 19 | string f = d.filename; |
| 20 | d.buffer[0] = 'a'; |
| 21 | } |