[Issue 2735] Can't assign ref function to function pointer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 15 10:11:21 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=2735





------- Comment #1 from jarrett.billingsley at gmail.com  2009-03-15 12:11 -------
I suppose it should be mentioned that it's not possible to declare a ref
function pointer, or else this would be a no-brainer:

ref int c() { static int a=2; return a; }
ref int function() d = &c; // line 8

foo.d(8): variable foo.d only parameters or foreach declarations can be ref

Type inference, however, is able to figure it out:

ref int c() { static int a=2; return a; }
auto d = &c; // whee


-- 



More information about the Digitalmars-d-bugs mailing list