matching overloaded functions (std.string.toString)

Rick Mann rmann-d-lang at
Sat Feb 3 12:55:46 PST 2007

I'm not sure I understand the matching rules for overloaded functions. I have a type:

typedef int OSStatus;

and I want to call

OSStatus err;

but I get these errors:

function std.string.toString called with argument types:
matches both:

It more readily matches toString(int). I realize the spec says that if a match is ambiguous, then it's an error, but it sure would be nice if this worked.

So, I tried defining my own toString(OSStatus):

toString(OSStatus inVal)
	return std.string.toString(cast (int) inVal);

But I get the same error.

Can someone tell me why? Surely an exact match would be acceptable. Thanks!

More information about the Digitalmars-d-learn mailing list