[Issue 23203] New: Wrong error message for argument mismatch on shared objects
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jun 22 08:40:45 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23203
Issue ID: 23203
Summary: Wrong error message for argument mismatch on shared
objects
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: sludwig at outerproduct.org
The following produces a very misleading error message, indicating that
`shared` is the problem, whereas the actual issue is a simple argument type
mismatch. Having only the shared method in the overload set fixes the issue.
---
struct S {
void foo(string s) {}
void foo(string s) shared {}
}
void main()
{
shared(S) s;
s.foo(42);
}
---
onlineapp.d(9): Error: none of the overloads of `foo` are callable using a
`shared` object
onlineapp.d(2): Candidates are: `onlineapp.S.foo(string s)`
onlineapp.d(3): `onlineapp.S.foo(string s)`
--
More information about the Digitalmars-d-bugs
mailing list