Template conflict?

Mike L. mike.linford at gmail.com
Sun Feb 15 00:30:02 PST 2009


Derek Parnell Wrote:

> On Sun, 15 Feb 2009 02:20:50 -0500, Mike L. wrote:
> 
> > Can anybody explain why I get the following error:
> > 
> > test.d(28): Error: test.tblahTemplate!(uint).tblah at test.d(13) conflicts with
> > test.tblahTemplate!(int).tblah at test.d(13)
> 
> > 		tblah(3);
> 
> It fails because of the literal '3'. The compiler cannot be sure if you
> want the 'int' or 'uint' function called because '3' matches both of them.
> 
> You need to make the literal explicit...
> 
>  		tblah(3u); -- uint call
>  		tblah(cast(int)3); -- int call
> 
> 
> -- 
> Derek Parnell
> Melbourne, Australia
> skype: derek.j.parnell

But what confuses me is that it needs it for the template, but not when I create blah() without templates. Why the inconsistency?



More information about the Digitalmars-d-learn mailing list