d: Merge upstream dmd, druntime 4c18eed967, phobos d945686a4.
[official-gcc.git] / gcc / testsuite / gdc.test / fail_compilation / diag1730.d
blob0ab51422ba1c055740af31c64481f7f1ccf41b85
1 /*
2 TEST_OUTPUT:
3 ---
4 fail_compilation/diag1730.d(51): Error: mutable method `diag1730.S.func` is not callable using a `inout` object
5 fail_compilation/diag1730.d(43): Consider adding `const` or `inout` here
6 fail_compilation/diag1730.d(53): Error: `immutable` method `diag1730.S.iFunc` is not callable using a `inout` object
7 fail_compilation/diag1730.d(54): Error: `shared` mutable method `diag1730.S.sFunc` is not callable using a non-shared `inout` object
8 fail_compilation/diag1730.d(46): Consider adding `const` or `inout` here
9 fail_compilation/diag1730.d(55): Error: `shared` `const` method `diag1730.S.scFunc` is not callable using a non-shared `inout` object
10 fail_compilation/diag1730.d(70): Error: `immutable` method `diag1730.S.iFunc` is not callable using a mutable object
11 fail_compilation/diag1730.d(71): Error: `shared` method `diag1730.S.sFunc` is not callable using a non-shared object
12 fail_compilation/diag1730.d(72): Error: `shared` `const` method `diag1730.S.scFunc` is not callable using a non-shared mutable object
13 fail_compilation/diag1730.d(75): Error: mutable method `diag1730.S.func` is not callable using a `const` object
14 fail_compilation/diag1730.d(43): Consider adding `const` or `inout` here
15 fail_compilation/diag1730.d(77): Error: `immutable` method `diag1730.S.iFunc` is not callable using a `const` object
16 fail_compilation/diag1730.d(78): Error: `shared` mutable method `diag1730.S.sFunc` is not callable using a non-shared `const` object
17 fail_compilation/diag1730.d(46): Consider adding `const` or `inout` here
18 fail_compilation/diag1730.d(79): Error: `shared` `const` method `diag1730.S.scFunc` is not callable using a non-shared `const` object
19 fail_compilation/diag1730.d(82): Error: mutable method `diag1730.S.func` is not callable using a `immutable` object
20 fail_compilation/diag1730.d(43): Consider adding `const` or `inout` here
21 fail_compilation/diag1730.d(85): Error: `shared` mutable method `diag1730.S.sFunc` is not callable using a `immutable` object
22 fail_compilation/diag1730.d(46): Consider adding `const` or `inout` here
23 fail_compilation/diag1730.d(89): Error: non-shared method `diag1730.S.func` is not callable using a `shared` object
24 fail_compilation/diag1730.d(43): Consider adding `shared` here
25 fail_compilation/diag1730.d(90): Error: non-shared `const` method `diag1730.S.cFunc` is not callable using a `shared` mutable object
26 fail_compilation/diag1730.d(44): Consider adding `shared` here
27 fail_compilation/diag1730.d(91): Error: `immutable` method `diag1730.S.iFunc` is not callable using a `shared` mutable object
28 fail_compilation/diag1730.d(94): Error: non-shared `inout` method `diag1730.S.wFunc` is not callable using a `shared` mutable object
29 fail_compilation/diag1730.d(48): Consider adding `shared` here
30 fail_compilation/diag1730.d(96): Error: non-shared mutable method `diag1730.S.func` is not callable using a `shared` `const` object
31 fail_compilation/diag1730.d(43): Consider adding `shared` here
32 fail_compilation/diag1730.d(97): Error: non-shared `const` method `diag1730.S.cFunc` is not callable using a `shared` `const` object
33 fail_compilation/diag1730.d(44): Consider adding `shared` here
34 fail_compilation/diag1730.d(98): Error: `immutable` method `diag1730.S.iFunc` is not callable using a `shared` `const` object
35 fail_compilation/diag1730.d(99): Error: `shared` mutable method `diag1730.S.sFunc` is not callable using a `shared` `const` object
36 fail_compilation/diag1730.d(46): Consider adding `const` or `inout` here
37 fail_compilation/diag1730.d(101): Error: non-shared `inout` method `diag1730.S.wFunc` is not callable using a `shared` `const` object
38 fail_compilation/diag1730.d(48): Consider adding `shared` here
39 ---
41 struct S
43 void func() { }
44 void cFunc() const { }
45 void iFunc() immutable { }
46 void sFunc() shared { }
47 void scFunc() shared const { }
48 void wFunc() inout { }
49 static void test(inout(S) s)
51 s.func(); // ng
52 s.cFunc();
53 s.iFunc(); // ng
54 s.sFunc(); // ng
55 s.scFunc(); // ng
56 s.wFunc();
60 void main()
62 S obj;
63 const(S) cObj;
64 immutable(S) iObj;
65 shared(S) sObj;
66 shared(const(S)) scObj;
68 obj.func();
69 obj.cFunc();
70 obj.iFunc(); // ng
71 obj.sFunc(); // ng
72 obj.scFunc(); // ng
73 obj.wFunc();
75 cObj.func(); // ng
76 cObj.cFunc();
77 cObj.iFunc(); // ng
78 cObj.sFunc(); // ng
79 cObj.scFunc(); // ng
80 cObj.wFunc();
82 iObj.func(); // ng
83 iObj.cFunc();
84 iObj.iFunc();
85 iObj.sFunc(); // ng
86 iObj.scFunc();
87 iObj.wFunc();
89 sObj.func(); // ng
90 sObj.cFunc(); // ng
91 sObj.iFunc(); // ng
92 sObj.sFunc();
93 sObj.scFunc();
94 sObj.wFunc(); // ng
96 scObj.func(); // ng
97 scObj.cFunc(); // ng
98 scObj.iFunc(); // ng
99 scObj.sFunc(); // ng
100 scObj.scFunc();
101 scObj.wFunc(); // ng