[Issue 1856] Outstanding template issues

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 10 02:36:36 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1856





------- Comment #5 from wbaxter at gmail.com  2008-03-10 04:36 -------
(In reply to comment #4)
> d-bugmail at puremagic.com wrote:
> > http://d.puremagic.com/issues/show_bug.cgi?id=1856
>> > 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.

So you're saying 
 int x = 3;
  foo(3);
would call the function instead of the generic template?
If so then ok.
If it's an ambiguity error, then that's ok too I suppose.
But if it prefers the template in this case, that seems like it could lead to
unexpected results.


-- 



More information about the Digitalmars-d-bugs mailing list