On Thursday, 14 August 2014 at 01:10:54 UTC, Andrei Alexandrescu wrote:
Destroy https://issues.dlang.org/show_bug.cgi?id=13291?

Andrei

It's worth noting that you can currently do this:

template fun(T)
{
        int fun(T val)
        {
                static if(is(T == string) || is(T == float))
                {
                        return 0;
                }
                else
                {
                        return 1;
                }
        }
        
        unittest
        {
                assert(fun(T.init) == 0);
        }
}

void main()
{
        fun("test"); //Ok
        fun(3.0f);   //Ok
        fun(1);      //AssertError thrown
}

Reply via email to