On 05/04/2012 03:00 PM, Jakob Ovrum wrote:
On Friday, 4 May 2012 at 12:45:23 UTC, Timon Gehr wrote:
This should work:

const(Thing) function()ref blah2 = &func;

Except that it does not, because 'ref' is not currently a valid
function 'storage class'. This seems to be an issue that deserves a
bug report.

For ref functions, 'ref' is part of the return type syntax,

If it was, then ref const(Thing) function() would work.

much like auto functions.
There is no precedent for 'ref' working as a function
attribute; it never was one.


It is an attribute:

int x;
ref {
  int foo(){ return x; }
  int bar(){ return x; }
}

ref:

int qux(){ return x; }

static assert(typeof(&qux).stringof == "int function() ref");

Reply via email to