]> gcc.gnu.org Git - gcc.git/blob - gcc/testsuite/gdc.test/fail_compilation/test16095.d
Add D front-end, libphobos library, and D2 testsuite.
[gcc.git] / gcc / testsuite / gdc.test / fail_compilation / test16095.d
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
18 void test1(C a)
19 {
20 (&a.ping)(); // error
21 }
22
23 struct S
24 {
25 void ping() shared;
26 }
27
28 void test2(S* a)
29 {
30 (&a.ping)(); // error
31 }
32
33 struct Foo {
34 bool flag;
35 void flip() {
36 flag = true;
37 }
38 }
39
40 void test3()
41 {
42 immutable Foo foo;
43 (&foo.flip)(); // error
44 }
This page took 0.037218 seconds and 5 git commands to generate.