Summary: No way to write function/delegate literals returning
                    ref T
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Gašper Ažman <> 2012-05-08 03:42:20 
PDT ---
Currently, I (with the help of #D on couldn't find any way to
define a function or delegate literal returning a reference.

our best guess at the syntax was

delegate ref T (params) { body }

or, to be more general,

delegate ATTRIBUTE T (params) { body }

void main() {
    auto bar = new int[5];
    auto foo = delegate ref int(size_t i) { return bar[i]; };

This example fails with the error "basic type expected, not ref".

Note: even if this did work, assigning functions returning ref does not work
properly, so this bug depends on #8064.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to