d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / fail20073.d
blob01a9ede4622c6d2c45acfa53d5d915e33f61e58b
1 // https://issues.dlang.org/show_bug.cgi?id=20073
2 /*
3 TEST_OUTPUT:
4 ---
5 fail_compilation/fail20073.d(20): Error: cannot implicitly convert expression `s` of type `S` to `string`
6 fail_compilation/fail20073.d(21): Error: cannot implicitly convert expression `s` of type `S` to `string`
7 ---
8 */
10 struct S
12 char[10] x;
13 auto slice() inout { return x[0 .. 10]; }
14 alias slice this;
18 string test() {
19 S s;
20 string str = s; // cannot implicitly convert expression `s` of type `S` to `string`
21 return s; // and suddenly we can!