d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / test16095.d
blob38a3a7dfbc9d135337f35c0fc042abaffd2722cd
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/test16095.d(18): Error: `shared` method `test16095.C.ping` is not callable using a non-shared `a`
5 fail_compilation/test16095.d(28): Error: `shared` method `test16095.S.ping` is not callable using a non-shared `*a`
6 fail_compilation/test16095.d(41): Error: mutable method `test16095.Foo.flip` is not callable using a `immutable` `foo`
7 ---
8 */
9 // https://issues.dlang.org/show_bug.cgi?id=16095
11 class C
13 void ping() shared;
16 void test1(C a)
18 (&a.ping)(); // error
21 struct S
23 void ping() shared;
26 void test2(S* a)
28 (&a.ping)(); // error
31 struct Foo {
32 bool flag;
33 void flip() {
34 flag = true;
38 void test3()
40 immutable Foo foo;
41 (&foo.flip)(); // error