Template specializations in unittest blocks

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 8 11:16:26 PDT 2015


On 06/08/2015 08:10 PM, Jeffrey Tsang wrote:
> The following works:
>
> enum foo(int x) = x + foo!(x - 1);
> enum foo(int x : 0) = 0;
>
> enum bar(T) = cast(T) 3;
> enum bar(T : int) = 4;
>
> Wrap it in a unittest{}, and complaints about multiply defined templates
> hit. Is there a reason for this?

No good reason. DMD doesn't let local symbols overload against each other.


More information about the Digitalmars-d mailing list