//code starts

import std.traits;

void main()
{
        static assert(__traits(isSame, TemplateOf!(T!arr), T));
}

size_t[] arr;

struct T(alias S)
{
        mixin Contents!() contents;

        this(Args)(ref Args args)
        {
                contents.__ctor(42);
        }
}

static assert(__traits(isSame, TemplateOf!(T!arr), T));

mixin template Contents()
{
        int dummy;
        this(int dummy)
        {
                //static assert(__traits(isSame, TemplateOf!(T!arr), T));
        }
}

//code ends

Given the code above, why the static assert inside the mixing template constructor yields false, while the others yield true?

Reply via email to