Bug 18825 – No syntax for function literal returning a reference

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-05-04T11:49:10Z
Last change time
2019-04-07T16:18:48Z
Keywords
pull
Assigned to
No Owner
Creator
Jean-Louis Leroy

Comments

Comment #0 by jl — 2018-05-04T11:49:10Z
Consider: int global; int foo() { return global; } As per the doc, this is equivalent to: auto foo = function int() { return global; }; But it is not possible to create a function literal equivalent to this: ref int foo() { return global; } I tried placing the ref everywhere it makes sense, to no avail.
Comment #1 by dlang-bot — 2019-04-05T20:06:19Z
@BorisCarvajal updated dlang/dmd pull request #9558 "Fixes issues 16271, 18825, 8065, 5050 - Allow function literals return by reference" fixing this issue: - Fixes issues 16271, 18825, 8065, 5050 - Allow function literals return by reference https://github.com/dlang/dmd/pull/9558
Comment #2 by dlang-bot — 2019-04-07T16:18:48Z
dlang/dmd pull request #9558 "Fixes issues 16271, 18825, 8065, 5050 - Allow function literals return by reference" was merged into master: - 60251b8f0e191a8f0f5142ddd2d3807d0e06c58a by Boris Carvajal: Fixes issues 16271, 18825, 8065, 5050 - Allow function literals return by reference https://github.com/dlang/dmd/pull/9558