I have this:


enum Type { a };
struct S(Type t = Type.a)
{
    this(Type)(Type t)
    {
        import std.stdio;
        writeln("ctor called.");
    }
}
void main()
{
   auto x = S!(Type.a)(Type.a);
   void* y = &x;
   auto z = (cast(S!(Type.a)) y);
}


Surprisingly the cast will actually call the ctor. Is this to be expected? Sure looks like a bug to me, as a non templated S will complain about the cast.

Reply via email to