Overloading issue with enum in dmd 1.006

renoX renosky at free.fr
Tue Feb 20 10:31:59 PST 2007


Tested in dmd 1.006 on Linux, the two toString definitions conflicts 
when they are in main, not when they are out of the main function.

import std.stdio;
int main(char[][] args)
{	
	enum Foo { A , B };
	enum Foo2 { C , D };
	
	char[] toString(Foo x)
	{
		return "1";
	}
	char[] toString(Foo2 x)
	{
		return "2";
	}	

     Foo s = Foo.A;
     writefln("s is %s, with name %s\n", s, toString(s));
	
     Foo2 o = Foo2.C;
     writefln("o is %s, with name %s\n", o, toString(o));
     return 0;
}

regards,
renoX


More information about the Digitalmars-d-bugs mailing list