| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/diag8101b.d(28): Error: none of the overloads of `foo` are callable using argument types `(double)` |
| 5 |
fail_compilation/diag8101b.d(19): Candidates are: `diag8101b.S.foo(int __param_0)` |
| 6 |
fail_compilation/diag8101b.d(20): `diag8101b.S.foo(int __param_0, int __param_1)` |
| 7 |
fail_compilation/diag8101b.d(30): Error: function `diag8101b.S.bar(int __param_0)` is not callable using argument types `(double)` |
| 8 |
fail_compilation/diag8101b.d(30): cannot pass argument `1.0` of type `double` to parameter `int __param_0` |
| 9 |
fail_compilation/diag8101b.d(33): Error: none of the overloads of `foo` are callable using a `const` object with argument types `(int)` |
| 10 |
fail_compilation/diag8101b.d(19): Candidates are: `diag8101b.S.foo(int __param_0)` |
| 11 |
fail_compilation/diag8101b.d(20): `diag8101b.S.foo(int __param_0, int __param_1)` |
| 12 |
fail_compilation/diag8101b.d(35): Error: mutable method `diag8101b.S.bar` is not callable using a `const` object |
| 13 |
fail_compilation/diag8101b.d(22): Consider adding `const` or `inout` here |
| 14 |
--- |
| 15 |
*/ |
| 16 |
|
| 17 |
struct S |
| 18 |
{ |
| 19 |
void foo(int) { } |
| 20 |
void foo(int, int) { } |
| 21 |
|
| 22 |
void bar(int) { } |
| 23 |
} |
| 24 |
|
| 25 |
void main() |
| 26 |
{ |
| 27 |
S s; |
| 28 |
s.foo(1.0); |
| 29 |
|
| 30 |
s.bar(1.0); |
| 31 |
|
| 32 |
const(S) cs; |
| 33 |
cs.foo(1); |
| 34 |
|
| 35 |
cs.bar(1); |
| 36 |
} |