void foo(ref string x) { } void bar(ref int x) { } void main() { foo("var"); immutable int x; bar(x); } test.d(8): Error: function test.foo (ref string x) is not callable using argument types (string) test.d(10): Error: function test.bar (ref int x) is not callable using argument types (immutable(int)) test.d(10): Error: constant 0 is not an lvalue The error for the 'foo' function should generate two error messages just like the error for 'bar. It could print: 'Error: constant "var" is not an lvalue'. This is especially useful in templated functions.
(In reply to comment #0) > test.d(8): Error: function test.foo (ref string x) is not callable using > argument types (string) > > test.d(10): Error: function test.bar (ref int x) is not callable using argument > types (immutable(int)) > test.d(10): Error: constant 0 is not an lvalue > > The error for the 'foo' function should generate two error messages just like > the error for 'bar. > > It could print: 'Error: constant "var" is not an lvalue'. This is especially > useful in templated functions. Or maybe better, generate a single error message in both cases, something like: test.d(10): Error: function test.bar (ref int x) is not callable using argument types (immutable(int)), constant 0 is not an lvalue.
It now prints: onlineapp.d(6): Error: function onlineapp.foo(ref string x) is not callable using argument types (string) onlineapp.d(6): cannot pass rvalue argument "var" of type string to parameter ref string x onlineapp.d(8): Error: function onlineapp.bar(ref int x) is not callable using argument types (immutable(int)) onlineapp.d(8): cannot pass argument x of type immutable(int) to parameter ref int x Which is the correct behavior. Closing as fixed.