ref int delegate( ref int ) r = ( ref int a ) { return a; }; The above gives "found 'ref' instead of statement"
Still happens on latest git HEAD. :-(
You can do it with an alias: alias ref int delegate(ref int) dg_t; dg_t r = ...;
@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
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