Is this an rvalue reference problem?
Gary Willoughby via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Dec 27 08:05:39 PST 2015
See the following code:
import std.stdio;
void foo(ref int x)
{
writefln("%s", x);
}
void main(string[] args)
{
int y = 0;
foo(y++);
}
When compiled it produces this error:
test.d(11): Error: function test.foo (ref int x) is not callable
using argument types (int)
If I remove the post-increment of the y variable if works. Is
this an rvalue reference issue? Would you expect this to work?
Should the error message be a little more helpful?
More information about the Digitalmars-d-learn
mailing list