Bug 21254 – Terse lambda syntax does not allow specifying ref return type

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-09-16T05:20:40Z
Last change time
2020-09-16T05:33:01Z
Assigned to
No Owner
Creator
Andrej Mitrovic

Comments

Comment #0 by andrej.mitrovich — 2020-09-16T05:20:40Z
----- 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; } -----
Comment #1 by ag0aep6g — 2020-09-16T05:33:01Z
It's: auto get = ref (ref S s) => s.val; Closing as invalid.