March 18, 2019 [Issue 19749] New: Inout causes wrong type inference | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19749 Issue ID: 19749 Summary: Inout causes wrong type inference Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: ali.akhtarzada@gmail.com Using inout with type constructors causes the wrong type to be inferred. 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")]; Probably related to 19126. -- |
Copyright © 1999-2021 by the D Language Foundation