www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Re: Array Operations and type inference

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
Aug 08 2010