Implicit cast rules of dynamic array

Erik Baklund ebaklund at hotmail.com
Sat Sep 3 13:36:07 PDT 2011


Hi,

Do anybody know if the implicit casting rules of float[] in the example below,
works as intended?

E.

--

// dmd v2.054
module main;

struct MyStruct
{
	void funOpAssign(float[1u] data) { }
	void opOpAssign(string op)(float[1u] data) if(op=="<<") { }
}

int main(string[] argv)
{
	MyStruct s;
	float[1u] a = [1.0f]; // Compiles
	s.funOpAssign([1.0f]); // Compiles
	s <<= [1.0f]; // Issue: Does not compile
	s <<= cast(float[1u])[1.0f]; // Compiles

	return 0;
}


More information about the Digitalmars-d-learn mailing list