Why I can't use array in compile-time struct creation?

Weed resume755 at mail.ru
Sat Dec 13 16:51:06 PST 2008


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


More information about the Digitalmars-d-learn mailing list