initializer for array of function literals

spir denis.spir at gmail.com
Sun Oct 31 12:55:28 PDT 2010


On Sun, 31 Oct 2010 09:16:55 -0400
bearophile <bearophileHUGS at lycos.com> wrote:

> Don:
> 
> > I think that's a bug. I can't think of any reason why that shouldn't work.
> 
> http://d.puremagic.com/issues/show_bug.cgi?id=5143

The bug report states an issue about func arrays, but:

// ok
void f (int a) {};
static void function(int) foo = &f;

// not ok
static void function(int) foo = function void(int a) {};

Error: non-constant expression __funcliteral1

It seems to me the issue is that one cannot init a func variable with a func literal. Array or not. What does the compiler expect there?


Deniq
-- -- -- -- -- -- --
vit esse estrany ☣

spir.wikidot.com



More information about the Digitalmars-d-learn mailing list