Array Operations and type inference
bearophile
bearophileHUGS at lycos.com
Sun Aug 8 14:15:59 PDT 2010
Don:
> That is bug 4578, which has been fixed, and will be in the next compiler release.
Good, there is no need to file it then.
simendsjo post shows two more cases, this is the first:
> {
> double[3] a = [1,1,1];
> auto b = a[] + 3; // What happens here?
> writeln(typeof(b).stringof); // double[]
> assert(b.length == 3);
> assert(b.capacity == 0);
> //writeln(b); // access violation
> }
The runtime has to catch the assignment bug in the line annotated with "What happens here?". I think there is already a bug in bugzilla for this so I will not add it.
> { // Same as above?
> double[3] a = [1,1,1];
> //writeln(a[] + 3); // access violation
> }
I don't remember if this case is already in bugzilla, and I don't know if the compiler can catch it. I add it to bug 3817 because I am not sure.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list