Bug 10035 – Rebindable does not work with CTFE

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-05T16:15:00Z
Last change time
2014-01-14T07:37:11Z
Assigned to
nobody
Creator
issues.dlang

Comments

Comment #0 by issues.dlang — 2013-05-05T16:15:27Z
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 ***