Warning: explicit element-wise assignment (this.vector)[] = vec.vector[cast(ulong)0..cast(ulong)dimension]

bearophile bearophileHUGS at lycos.com
Mon Jun 24 16:11:24 PDT 2013


Ali Çehreli:

> I am confused. Even if the right-hand expression were a 
> fixed-length array? If so, then we wouldn't speak of their 
> being value types. (?)
>
>     a = b;    // should be fine
>
> Otherwise, fixed-length arrays would become weird types that 
> cannot be used in assignment operations.
>
> I just read the change log. Either it is incorrect or the 
> change is implemented inccorrectly because it is supposed to be 
> about the right-hand side. So, OP's code is correct after all.

Sorry, my mistake, I have confused the two things a bit, 
regarding the position of the [].

Currently this code gives no warnings:

void main() {
     int[3] a, b;
     a = b;
}

This topic is discussed a little in Issue 7444.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list