www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13430] New: Improve error message with wrong arg type to


          Issue ID: 13430
           Summary: Improve error message with wrong arg type to inout
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: turkeyman gmail.com

This error message had me scratching my head for half an hour. Please fix this
situation to report the appropriate error.

This code produces the error:
  Error: inout method db.ui.listadapter.S.f is not callable using a mutable

struct S
    inout(int) f(int x) inout // inout method
        return x;

void f(size_t s)
    S x;

    // call it with the wrong type (size_t, expects int)
    x.f(s); // very surprising error message

    // call with appropriate type, no problem

Sep 06 2014