www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19301] New: [DIP1000] missing overload abilities

https://issues.dlang.org/show_bug.cgi?id=19301

          Issue ID: 19301
           Summary: [DIP1000] missing overload abilities
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ilyayaroshenko gmail.com

struct D
{
    const(char)[] d;
    this(scope const(char)[] d)  safe
    {
        this.d = "static_string";
    }

    this(string d)  safe
    {
        this.d = d;
    }
}

D func(scope string s)  safe
{
    return D(s);
}

---------
Error: scope variable s assigned to non-scope parameter d calling
mir.exception.D.this

Expected behavior: pass using `this(scope const(char)[] d)`

--
Oct 11 2018