July 25, 2004 resizing static array in struct | ||||
---|---|---|---|---|
| ||||
The message produced by this code is rather cryptic:
/////////////////////////
struct A
{
int [10] arr; //line 3
}
void main ()
{
A a;
a.arr.length = 20; //line 9
}
/////////////////////////
> dmd test.d
test.d(3): *(#a + 0).length is not an lvalue
However the error is gone if line 9 is removed.
The same happens if A is a union, but not if it's a class.
-----------------------
Carlos Santander Bernal
|
Copyright © 1999-2021 by the D Language Foundation