digitalmars.D.learn - Why I can't use array in compile-time struct creation?
- Weed (19/19) Dec 13 2008 It is forbidden by specification, but an interesting reason.
It is forbidden by specification, but an interesting reason.
for example:
struct S
{
static S opCall()
{
S res;
int a,b,c,d;
int[10] data; // If I comment out this line compilation goes
smoothly
return res;
}
}
void main()
{
static S s = S();
}
struct_array.d(14): Error: cannot evaluate opCall() at compile time
struct_array.d(14): Error: cannot evaluate opCall() at compile time
Dec 13 2008








Weed <resume755 mail.ru>