Thread overview
Overload sets and templates
Feb 08, 2014
Nick Sabalausky
Feb 08, 2014
Timon Gehr
Feb 08, 2014
Nick Sabalausky
February 08, 2014
This works:

------------------------------
void foo(T)(T t) if(is(T==char)) {}
void foo(T)(T t) if(is(T==int )) {}

void main() { foo(1); }
------------------------------

But if I move the "int" version to a different module, and try to alias it into the current module's overload set (like I can with non-templated functions), I just get an error that the "char" version of foo conflicts with the alias:

------------------------------
module a;
import b;

alias foo = b.foo;
void foo(T)(T t) if(is(T==char)) {}

void main() { foo(1); }
------------------------------
module b;
void foo(T)(T t) if(is(T==int)) {}
------------------------------

What's up with that? Is there a way to do it?
February 08, 2014
On 02/08/2014 10:46 AM, Nick Sabalausky wrote:
> This works:
>
> ------------------------------
> void foo(T)(T t) if(is(T==char)) {}
> void foo(T)(T t) if(is(T==int )) {}
>
> void main() { foo(1); }
> ------------------------------
>
> But if I move the "int" version to a different module, and try to alias
> it into the current module's overload set (like I can with non-templated
> functions), I just get an error that the "char" version of foo conflicts
> with the alias:
>
> ------------------------------
> module a;
> import b;
>
> alias foo = b.foo;
> void foo(T)(T t) if(is(T==char)) {}
>
> void main() { foo(1); }
> ------------------------------
> module b;
> void foo(T)(T t) if(is(T==int)) {}
> ------------------------------
>
> What's up with that? Is there a way to do it?

What you are trying to do should work. I.e. this is a compiler bug.
February 08, 2014
On 2/8/2014 11:35 AM, Timon Gehr wrote:
>
> What you are trying to do should work. I.e. this is a compiler bug.

Thanks. Filed:
https://d.puremagic.com/issues/show_bug.cgi?id=12111