templated overload of opAssign
frame
frame86 at live.com
Sun Apr 4 16:38:10 UTC 2021
On Saturday, 3 April 2021 at 13:46:17 UTC, kdevel wrote:
> Why does this code
> ec.opAssign (bar (1)); // okay
> // ec = bar (1); // Error: expression bar(1) is void and has
> no value
> compile with the abovementioned error?
You cannot assign void returned from bar() as parameter to
opAssign(). The lazy keyword creates some internal delegate, thus
opAssign() works instead. I'm afraid lazy storage class only
works with arguments, not rvalues.
More information about the Digitalmars-d-learn
mailing list