void test1(T)(auto ref const T[] val) {} void main() { string a; test1(a); } Output: Error: cast(const(char[]))a is not an lvalue
https://github.com/D-Programming-Language/dmd/pull/1354
This also happens with ref and plain types. ---- void test1(ref const char[] val) {} void main() { string a; test1(a); } ---- void test1(ref const(char) val) {} void main() { immutable char a; test1(a); } ----
(In reply to comment #2) > This also happens with ref and plain types. > Does an implicit const cast means to become an rvalue. But still auto ref and implicit const cast doesn't work for integral types too. void test1()(auto ref const char val) {} void main() { immutable char a; test1(a); }
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/03e88e1a731dd941dad4861134e8568abe54ab1b fix Issue 9090 - auto ref doesn't work with arrays https://github.com/D-Programming-Language/dmd/commit/3302a4b852772d24c0735419a35cba0b754100aa Merge pull request #1354 from 9rnsr/fix9090 Issue 9090 - auto ref doesn't work with arrays