[ddbg] "Access violation" and "Invalid val type" with dictionaries

Ary Manzana ary at esperanto.org.ar
Tue Jun 26 15:00:20 PDT 2007


Hi Jascha,

Take the following code:

---
module main;

import std.stdio;

class Point {
	
	int x;
	int y;
	
	this(int x, int y) {
		this.x = x;
		this.y = y;
	}
	
	public override char[] toString() {
		return "(" ~ std.string.toString(x) ~ ", " ~ std.string.toString(y) ~ ")";
	}
	
}

void main() {
	Point[int] dictionary;
	dictionary[1] = new Point(1, 10);
	dictionary[2] = new Point(2, 20);
	dictionary[3] = new Point(3, 30);
	
	writefln("%s", dictionary[1]);
}
---

If you run it, you'll see (1, 10) as the output. However, if you set a 
breakpoint in the writefln line and you try to access dictionary[1]:

->= dictionary[1]
Access Violation
->= dictionary[cast(int)1]
Access Violation

Further:

->= dictionary
invalid val type PC4main5Point

Is this a bug in ddbg?

Regards,
Ary


More information about the Digitalmars-d-debugger mailing list