Why is my code does not compile? (dmd 2.021 linux)

Weed resume755 at mail.ru
Fri Dec 12 12:45:19 PST 2008


void main()
{
     int i;

     ref int func()
     {
       return i;
     }

     func() = 4;
}

lval.d(5): found 'ref' instead of statement
lval.d(10): no identifier for declarator func
lval.d(11): unrecognized declaration


but code like this compiles:

ref int func()
{
   int* i = new int;
   return *i;
}

void main()
{
     func() = 4;
}


More information about the Digitalmars-d-learn mailing list