[Issue 1856] Outstanding template issues

Don Clugston dac at nospam.com.au
Mon Mar 10 02:22:40 PDT 2008


d-bugmail at puremagic.com wrote:
> http://d.puremagic.com/issues/show_bug.cgi?id=1856
> 
> 
> 
> 
> 
> ------- Comment #3 from wbaxter at gmail.com  2008-02-26 12:51 -------
> I just noticed that function-vs-template overloading was one of the items
> mentioned in WalterAndrei.pdf.
> 
> However, there it says "the function is not preferred over the template" so
> that means this would be an error?
> 
>   void foo(int i);
>   void foo(T)(T i);
> 
> That doesn't seem so good.  Why not treat functions like specializations?

I think that's the idea. In C, when there's a function and a template, the 
compiler ALWAYS chooses the function. No matter how inappropriate the function is.


More information about the Digitalmars-d-bugs mailing list