On Sunday, 27 December 2015 at 16:05:39 UTC, Gary Willoughby wrote:
If I remove the post-increment of the y variable if works. Is this an rvalue reference issue? Would you expect this to work?

This should work with *pre*-increment, but not post-increment. Post-increment works like this:

int y = 0;
foo(function(ref int val){
    int old = val;
    val += 1;
    return old;
}(y));

`old` is just a local temporary, so it is not safe to return it by reference. Thus, it becomes an rvalue.

Reply via email to