Address of parameterless ref function

Andrej Mitrovic andrej.mitrovich at gmail.com
Sat Apr 9 10:55:03 PDT 2011


Interesting. The problem I think is that the delegate is declared as
returning int, not ref int. I don't even think we can specify ref as
the return value of a delegate. But if you try to declare the delegate
as returning an int*, you get this nice error:

Error: cannot implicitly convert expression (& g) of type int
function() ref to int* function()

Still, you can't declare the delegate as "int function() ref" or "ref
int function()". I'm not sure why, or why int* can be implicitly cast
to int in this case.


More information about the Digitalmars-d mailing list