[Issue 12624] Internal error: backend\cgobj.c 2313 with Rebindable!(immutable TimeZone) in std.datetime

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Oct 10 23:40:09 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=12624

Rainer Schuetze <r.sagitario at gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario at gmx.de

--- Comment #3 from Rainer Schuetze <r.sagitario at gmx.de> ---
I've used this bug to test the DustMite integration of Visual D, the result
was:

// datetime.d
struct SysTime
{
    import typecons;

    Rebindable!(immutable TimeZone) _timezone = UTC();
}


class TimeZone
{
    this(string , string , string ) immutable {}
}


class UTC : TimeZone
{
    static immutable(UTC) opCall()
    {
        return _utc;
    }

    this() immutable {
        super("UTC", "UTC", "UTC");
    }

    static _utc = new immutable(UTC);
}


// typecons.d
template RebindableCommon(T, U, This)
{
    union { U stripped; }

    void opAssign(T another) 
    {
        stripped = cast() another;
    }

    this(T initializer)
    {
        opAssign(initializer);
    }
}


template Rebindable(T)
{
    static if (is(T == immutable U, U))
        struct Rebindable
    {
        mixin RebindableCommon!(T, U, Rebindable);
    }
}

////

compile with "dmd -lib datetime.d typecons.d" on git HEAD:
Internal error: backend\cgobj.c 2332

Compiling with "-c" instead of "-lib" does not raise the ICE.

--


More information about the Digitalmars-d-bugs mailing list