| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/fail11503d.d(26): Error: cannot implicitly convert expression `filename(d)` of type `const(char)[]` to `string` |
| 5 |
fail_compilation/fail11503d.d(27): Error: cannot implicitly convert expression `filename2(& d)` of type `const(char)[]` to `string` |
| 6 |
--- |
| 7 |
*/ |
| 8 |
struct Data2 |
| 9 |
{ |
| 10 |
char buffer; |
| 11 |
} |
| 12 |
|
| 13 |
@property const(char)[] filename(const return ref Data2 d) pure nothrow |
| 14 |
{ |
| 15 |
return (&d.buffer)[0 .. 1]; |
| 16 |
} |
| 17 |
|
| 18 |
@property const(char)[] filename2(const Data2* d) pure nothrow |
| 19 |
{ |
| 20 |
return (&d.buffer)[0 .. 1]; |
| 21 |
} |
| 22 |
|
| 23 |
void main() |
| 24 |
{ |
| 25 |
Data2 d; |
| 26 |
string f = d.filename; |
| 27 |
string g = (&d).filename2; |
| 28 |
d.buffer = 'a'; |
| 29 |
} |