d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / diag14145.d
blobfee73078e30115fedc466cdeaf8d7443dddf18cc
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/diag14145.d(16): Error: no property `i` for `_` of type `diag14145.main.Capture!(i)`
5 fail_compilation/diag14145.d(16): potentially malformed `opDispatch`. Use an explicit instantiation to get a better error message
6 fail_compilation/diag14145.d(26): struct `Capture` defined here
7 fail_compilation/diag14145.d(35): Error: expression `*this.ptr` of type `shared(int)` is not implicitly convertible to return type `ref int`
8 fail_compilation/diag14145.d(17): Error: template instance `diag14145.main.Capture!(i).Capture.opDispatch!"i"` error instantiating
9 ---
12 int main()
14 int i;
15 auto _ = capture!i;
16 _.i;
17 _.opDispatch!"i";
18 return 0;
21 auto capture(alias c)()
23 return Capture!c(c);
26 struct Capture(alias c)
28 shared typeof(c)* ptr;
29 this(ref typeof(c) _c)
31 ptr = cast(shared)&c;
33 ref shared typeof(c) opDispatch(string s)()
35 return *ptr;