Return by 'ref' problems...

Jakob Ovrum jakobovrum at gmail.com
Fri May 4 07:53:55 PDT 2012


On Friday, 4 May 2012 at 14:34:20 UTC, Timon Gehr wrote:
> 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");

Thanks, this is news to me! I never noticed that ref was actually 
a function attribute.

The following are legal declaration statements:

     extern(C) void function() foo;
     pure void function() bar; // not just linkage attributes

So I think it's a plain bug that this isn't:

     ref void function() foo;




More information about the Digitalmars-d mailing list