www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23203] New: Wrong error message for argument mismatch on


          Issue ID: 23203
           Summary: Wrong error message for argument mismatch on shared
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: sludwig 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;

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)`

Jun 22 2022