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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 18 10:26:16 UTC 2019


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

--- Comment #4 from Ali Ak <ali.akhtarzada at gmail.com> ---
Yes. This is super annoying.

It also messes up type inference where you need the types to be inferred
properly:

struct S(T) {
    T value = T.init;
}

auto ref make(T)(inout auto ref T value) {
    // T == char[] when infact it's string 
    return inout(S!T)(value);
}

auto ref f(T)(inout auto ref S!T s) {
    return make(s.value);
}

auto a = [make("hello"), S!string("hello")];

(plucked from duplicate issue)

--


More information about the Digitalmars-d-bugs mailing list