On Tuesday, 14 May 2013 at 03:20:59 UTC, Kenji Hara wrote:
Currently conditional compilation would stop IFTI.

template foo(T)
{
    static if (is(T == int))
        void foo(T) {}
}
void main()
{
    foo(1);   // shouldn't work
}

Same as above, DIP40 should prevent following case.

template foo(T)
{
    struct foo
    {
        static if (is(T == int))
            this(T) {}
    }
}
void main()
{
    foo(1); // also should not work
}

Kenji Hara


I think that should be consistent with the deduction mechanism proposed in the DIP:
foo is struct not in scope until template foo(T) is instantiated.

Reply via email to