On Monday, 26 August 2013 at 00:46:50 UTC, Jason den Dulk wrote:
Hi

Consider the following code

module A;

void xx(T:int)(T t) { .. }
void xx(T:float)(T t) { .. }


module B;
import A;

void xx(T:string)(T t) { .. }

void main()
{
  xx!(int)(4);
  xx(4.5);
  xx("abc");
}


The compiler won't let me do this. It will complain that xx!(int)(4) cannot be instantiated with xx(T:string). If I move xx(T:string) into its own module, the compiler complains about ambiguity. If I put them all in the same module, it works fine.

I read about overload sets in the docs and tried the "alias A.xx xx" suggestion, but the compiler didn't like that either.

Is there any way I can make this work without having to put them all in the same module?

Thanks in advance.
Jason.

It's a known bug: http://d.puremagic.com/issues/show_bug.cgi?id=10658

Reply via email to