www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Compiler error ambiguous...


int main () {
	char [] a = "12345";
	char b;
	b = myrountine(a,20);
	printf("%s, %d, %c",toStringz(a),a.length,b);
	return 0;

char myrountine(inout char[] input, uint param) {
         char[] strB = input;
         strB.size = param;
         input[0] = 'x';
         return strB[0];

D:\D\src\test\test.d(20): '8' is not an lvalue

D:\D\dmd\bin\dmd.exe -g -gt -debug -c  -I. -I.. -odD:\D\src\test 

The problem is strB.size was meant to be strB.length, 'strB.size' gets 
replaced by the actual size of strB which is 8, and the error is confusing 
(at first).

Perhaps Walter can un-replace the strB.size for the error message?

Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
May 11 2004