[Issue 13291] unittest should be allowed inside template functions

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Aug 14 13:57:06 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13291

--- Comment #5 from Andrei Alexandrescu <andrei at erdani.com> ---
(In reply to timon.gehr from comment #4)
> (In reply to Andrei Alexandrescu from comment #3)
> > Honest I did think of the template/eponymous trick but was too lazy to open
> > it for discussion... there would be issues of overloading etc. left to solve
> > with that one.
> 
> What are those issues?

I'm thinking of (a) putting two or more overloads inside the same template -
then the unittest can't distinguish which is being instantiated (arguably that
could be considered a mistaken us); (b) would overloading a template with a
generic function just work?

template fun(T) { void fun(T, int); }
void fun(T)(T, double);

Tried this, does work. I wonder if it works for all overloading cases.

--


More information about the Digitalmars-d-bugs mailing list