1 /*
2 REQUIRED_ARGS:
3 PERMUTE_ARGS:
4 TEST_OUTPUT:
5 ---
6 fail_compilation/test16095.d(20): Error: shared method test16095.C.ping is not callable using a non-shared a
7 fail_compilation/test16095.d(30): Error: shared method test16095.S.ping is not callable using a non-shared *a
8 fail_compilation/test16095.d(43): Error: mutable method test16095.Foo.flip is not callable using a immutable foo
9 ---
10 */
11 // https://issues.dlang.org/show_bug.cgi?id=16095
12 
13 class C
14 {
15     void ping() shared;
16 }
17 
test1(C a)18 void test1(C a)
19 {
20     (&a.ping)(); // error
21 }
22 
23 struct S
24 {
25     void ping() shared;
26 }
27 
test2(S * a)28 void test2(S* a)
29 {
30     (&a.ping)(); // error
31 }
32 
33 struct Foo {
34    bool flag;
flipFoo35    void flip() {
36         flag = true;
37    }
38 }
39 
test3()40 void test3()
41 {
42     immutable Foo foo;
43     (&foo.flip)();      // error
44 }
45