Fix12596 - Implement Typedef ctor that can take itself as the parameter.

This commit is contained in:
Andrej Mitrovic 2014-04-19 14:44:52 +02:00
parent 9579b42cc5
commit c69d2959e8

View file

@ -4234,6 +4234,11 @@ struct Typedef(T, T init, string cookie=null)
Typedef_payload = init;
}
this(Typedef tdef)
{
this(tdef.Typedef_payload);
}
mixin Proxy!Typedef_payload;
}
@ -4317,6 +4322,14 @@ unittest
}
}
unittest // Issue 12596
{
import std.typecons;
alias TD = Typedef!int;
TD x = TD(1);
TD y = TD(x);
assert(x == y);
}
/**
Allocates a $(D class) object right inside the current scope,