May 11, 2004
Hi,

[code]
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];
}

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

[cmdline]
D:\D\dmd\bin\dmd.exe -g -gt -debug -c  -I. -I.. -odD:\D\src\test "D:\D\src\test\test.d"


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/