May 05, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10035

           Summary: Rebindable does not work with CTFE
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: jmdavisProg@gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisProg@gmx.com> 2013-05-05 16:15:27 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------