D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19301 - [DIP1000] missing overload abilities
Summary: [DIP1000] missing overload abilities
Status: RESOLVED WONTFIX
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 enhancement
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2018-10-12 06:34 UTC by Илья Ярошенко
Modified: 2020-03-04 10:14 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Илья Ярошенко 2018-10-12 06:34:24 UTC
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)`
Comment 1 Walter Bright 2020-03-04 10:14:09 UTC
scope is deliberately not overloaded upon, as it would seem to be a very bizarre use case to do so.

Adding this would require significant discussion and evaluation, including compelling use cases. I.e. a DIP would be needed.