The following code compiles and correctly resolves the lvalue vs. non-lvalue overloading: import std.stdio; void doStuff(const ref int i) { writeln("Doing stuff by ref."); } void doStuff(const int i) { writeln("Forwarding to ref overload."); doStuff(i); } void main() { doStuff(1); } Similar code also works for classes and arrays. It seems to be broken for structs, though. The following code is rejected: import std.stdio; struct S {} bool fun(const ref S rhs) { return true; } bool fun(const S rhs) { return fun(rhs); } test9.d(12): Error: function test9.fun called with argument types: ((const(S))) matches both: test9.fun(ref const const(S) rhs) and: test9.fun(const const(S) rhs)
*** Issue 6201 has been marked as a duplicate of this issue. ***
This issue is part of bug5889. Add 'Depends on'.
*** Issue 7409 has been marked as a duplicate of this issue. ***
Compiles on 2.059 Win32
Indeed. The issue seems to be fixed.
*** This issue has been marked as a duplicate of issue 5889 ***