www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - weird frame bug

--[test.d]--
template test(T) {
	char[] test(T d) {
		uint sz = typeof(d[0]).sizeof * 2;
		return null;
	}
}

void main() {
	static ulong[5] a = [0,1,2,3,4];
	static uint[5] b = [0,1,2,3,4];
	printf("%.*s\n",test!(ulong[5])(a));
	printf("%.*s\n",test!(uint[5])(b));
}

D:\D\src\build\temp>dmd bug2.d
bug2.d(2): function test cannot access frame of function test

If I remove one of the printf lines, it goes away.
If I change the template to

template test(T) {
	char[] test(T d) {
		typeof(d[0]) u;
		uint sz = u.sizeof * 2;
		return null;
	}
}

it goes away.

Regan.

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