dmd/compiler/test/fail_compilation/diag8101b.d
Nick Treleaven 31c5a894d2 Fix 'no overloads callable using mutable object' wording
The error is wrong, it should include the argument types as well.
E.g. `fail_compilation/ctor_attr.d` shows this error even though there
is actually a mutable overload `foo(string)`.
2023-11-19 22:52:49 +01:00

36 lines
1.3 KiB
D

/*
TEST_OUTPUT:
---
fail_compilation/diag8101b.d(28): Error: none of the overloads of `foo` are callable using argument types `(double)`
fail_compilation/diag8101b.d(19): Candidates are: `diag8101b.S.foo(int __param_0)`
fail_compilation/diag8101b.d(20): `diag8101b.S.foo(int __param_0, int __param_1)`
fail_compilation/diag8101b.d(30): Error: function `diag8101b.S.bar(int __param_0)` is not callable using argument types `(double)`
fail_compilation/diag8101b.d(30): cannot pass argument `1.0` of type `double` to parameter `int __param_0`
fail_compilation/diag8101b.d(33): Error: none of the overloads of `foo` are callable using a `const` object with argument types `(int)`
fail_compilation/diag8101b.d(19): Candidates are: `diag8101b.S.foo(int __param_0)`
fail_compilation/diag8101b.d(20): `diag8101b.S.foo(int __param_0, int __param_1)`
fail_compilation/diag8101b.d(35): Error: mutable method `diag8101b.S.bar` is not callable using a `const` object
fail_compilation/diag8101b.d(22): Consider adding `const` or `inout` here
---
*/
struct S
{
void foo(int) { }
void foo(int, int) { }
void bar(int) { }
}
void main()
{
S s;
s.foo(1.0);
s.bar(1.0);
const(S) cs;
cs.foo(1);
cs.bar(1);
}