function XXXX conflict with YYYY

Gary Willoughby dev at nomad.so
Thu Nov 14 08:57:08 PST 2013


On Thursday, 14 November 2013 at 16:27:39 UTC, Agustin wrote:
> final uint registerEvent(T, J)(IPlugin, void delegate(J))
> {
>  ....
> }
>
> final uint registerEvent(IPlugin, EventHandler, EventInfo, 
> ulong)
> {
>  ....
> }
>
> There seems to be a problem when having two function with same 
> name but different parameters. Only happend when one of the 
> function use templates. Is that a compiler limitation?

This works fine with v2.064.2

import std.stdio;

class ClassName
{
	final uint registerEvent(T, J)(T x, void delegate(J))
	{
		return 1;
	}

	final uint registerEvent(long, string, int, ulong)
	{
		return 1;
	}
}

void main(string[] args)
{
	auto x = new ClassName();

	writefln("%s", x.registerEvent!(int, int)(1, delegate(int x) 
{}));
	writefln("%s", x.registerEvent(1, "sdsds", 3, 4));
}


More information about the Digitalmars-d-learn mailing list