const ref void[] – float[] not implicitly convertable to void[]

David d at dav1d.de
Mon Jul 23 03:04:09 PDT 2012


Is this a bug? – http://dpaste.dzfl.pl/31a16eab (code below)


------------
void test(const void* test, size_t length) {
}

void foo_const_ref(const ref void[] data) {
	test(data.ptr, data.length);
}

void foo_ref(ref void[] data) {
	test(data.ptr, data.length);
}

void foo(void[] data) {
	test(data.ptr, data.length);
}


void main() {
	float[] bar = [1.0f, 1.0f, 1.0f, 1.0f, 1.0f];
	void[] v_bar = bar;
	
	foo(bar);
	foo_ref(bar);
	foo_const_ref(bar);
	
	foo(v_bar);
	foo_ref(v_bar);
	foo_const_ref(v_bar);
}
------------
519.d(22): Error: function compileme519.foo_ref (ref void[] data) is not 
callable using argument types (float[])
519.d(22): Error: cast(void[])bar is not an lvalue
519.d(23): Error: function compileme519.foo_const_ref (ref const(void[]) 
data) is not callable using argument types (float[])
519.d(23): Error: cast(const(void[]))bar is not an lvalue
------------

Seems like float[] isn't convertable to void[] anylonger.


More information about the Digitalmars-d-learn mailing list