This code does not yet compile:
import std.typecons;
class C {}
struct S
{
Rebindable!(immutable C) c = new immutable(C);
}
void main() {}
Rather, it gives this error:
q.d(7): Error: Unions with overlapping fields are not yet supported in CTFE
q.d(7): Error: Unions with overlapping fields are not yet supported in CTFE
Rebindable uses a union
private union
{
T original;
U stripped;
}
where U is T Except that U is fully mutable where T is const or immutable. According to Don, supporting this in CTFE should be quite straightforward. And now that we can create immutable classes during CTFE and then use them at runtime, with this enhancement, I'll be able to default-initialize SysTime's timezone field (which is a Rebindable!(immutable TimeZone)) and make SysTime.init valid to use.
Comment #1 by k.hara.pg — 2014-01-14T07:37:11Z
Fixed in git-head.
*** This issue has been marked as a duplicate of issue 11510 ***