[Issue 21243] Allow lambdas to return auto ref
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Mar 4 16:32:58 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=21243
Andrei Alexandrescu <andrei at erdani.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andrei at erdani.com
--- Comment #1 from Andrei Alexandrescu <andrei at erdani.com> ---
Example per Paul:
void main()
{
alias f1(alias x) = () => x;
int n = 123;
assert(__traits(compiles, f!123())); // ok
assert(__traits(compiles, f!n() = 456)); // no good
}
If we add ref to the return value of the lambda, the other assertion fails.
--
More information about the Digitalmars-d-bugs
mailing list