| 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 |
| 10 |
|
| 11 |
class C |
| 12 |
{ |
| 13 |
void ping() shared; |
| 14 |
} |
| 15 |
|
| 16 |
void test1(C a) |
| 17 |
{ |
| 18 |
(&a.ping)(); // error |
| 19 |
} |
| 20 |
|
| 21 |
struct S |
| 22 |
{ |
| 23 |
void ping() shared; |
| 24 |
} |
| 25 |
|
| 26 |
void test2(S* a) |
| 27 |
{ |
| 28 |
(&a.ping)(); // error |
| 29 |
} |
| 30 |
|
| 31 |
struct Foo { |
| 32 |
bool flag; |
| 33 |
void flip() { |
| 34 |
flag = true; |
| 35 |
} |
| 36 |
} |
| 37 |
|
| 38 |
void test3() |
| 39 |
{ |
| 40 |
immutable Foo foo; |
| 41 |
(&foo.flip)(); // error |
| 42 |
} |