[Issue 19125] IFTI and inout removes head mutability qualifier on by-val parameters

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jul 17 15:36:39 UTC 2019


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

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|x86                         |All
                 OS|Mac OS X                    |All
           Severity|enhancement                 |regression

--- Comment #2 from Steven Schveighoffer <schveiguy at yahoo.com> ---
I have another simpler case which is absolutely unacceptable:

Nullable!string s;

string x = s.get(""); // error

This is because Nullable.get is taking the above input as an inout(char[])!

It should be inout(string).

Checking all versions, looks like this worked in 2.065 and prior. Well, the
concept worked anyway, since I don't think that form of get was added to
Nullable until later.

An equivalent test:

struct S
{
    string boo;
    auto get(U)(inout(U) u) inout
    {
        return boo.length == 0 ? u : boo;
    }
}
void main()
{
    S s;
    string x = s.get("");
}

This fails from 2.066 on. Changing to regression.

--


More information about the Digitalmars-d-bugs mailing list