[Issue 21254] New: Terse lambda syntax does not allow specifying ref return type
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Sep 16 05:20:40 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21254
Issue ID: 21254
Summary: Terse lambda syntax does not allow specifying ref
return type
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: andrej.mitrovich at gmail.com
-----
struct S
{
int val;
}
auto get = (ref S s) => s.val; // returns rvalue, not usable for our case
ref get = (ref S s) => s.val; // Error: variable `test.get` only parameters or
`foreach` declarations can be `ref`
void main ()
{
S s;
s.get() = 10;
}
-----
--
More information about the Digitalmars-d-bugs
mailing list