If I change line# 8960 in std.datetime.SysTime
Rebindable!(immutable TimeZone) _timezone;
to
Rebindable!(immutable TimeZone) _timezone = UTC();
then on 32-bit Windows, we get this wonderful error message
symbol 2366CD54 'internal'
Sclass = SCextern Ssymnum = -1 Sfl = FLextrn Sseg = 2
Soffset = x0010 Sweight = 0 Sflags = x21000 Sxtrnnum = 0
Stype = 2366CD2C Sl = 00000000 Sr = 00000000
Tty=TYint Tmangle=0 Tflags=x0 Tcount=1 Tsize=4 Tnext=00000000
Internal error: backend\cgobj.c 2313
--- errorlevel 1
It compiles just fine on the other platforms, but it fails on 32-bit Windows (64-bit Windows does not appear to currently be part of the autotester, so I don't know how it fairs there). Given the fact that "backend/cgobj.c" has the word backend in it, I assume that the bug is either in the glue layer with the backend or in the backend itself, but I don't know. Regardless, this is currently blocking
https://github.com/D-Programming-Language/phobos/pull/2088
Unfortunately, I have been unable to reproduce this problem with a test case separate from std.datetime, but it's very easy to reproduce with std.datetime.
Comment #1 by issues.dlang — 2015-10-08T00:18:18Z
Still happens with the latest master, though now it spits out
Internal error: backend\cgobj.c 2332
Comment #2 by issues.dlang — 2015-10-10T19:39:42Z
Well, this is a finicky one. I'd tried to reduce the failing code to something more manageable in the past and failed, but I thought that I'd take another stab at it, and simply copying the entire std.datetime module to a module separate from Phobos (and changing the module declaration of course) and then doing
Rebindable!(immutable TimeZone) _timezone = UTC();
works instead of failing like it does when that line is changed inside of Phobos.
It wouldn't surprise me if this problem simply went away when I finally split of std.datetime (which I think that I'm going to take another stab at getting done shortly) simply due to how specific the failure is - which just means that the compiler bug would then be hidden away again rather than anything truly having been fixed (which certainly isn't good), but if it went away like that, at least it wouldn't be blocking improvements to SysTime anymore.
Comment #3 by r.sagitario — 2015-10-11T06:40:09Z
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.
Comment #4 by issues.dlang — 2015-10-21T23:26:31Z
@yebblies At dconf, you were offering to look at this if it was still happening (which it is, though obviously it took me a while to get around to verifying that). So, I'm adding you to the cc list. Feel free to look into this or ignore it as your time allows, but it would be nice if this got fixed.
Comment #5 by yebblies — 2015-11-03T23:41:08Z
I'll add it to my list.
Comment #6 by dlang-bugzilla — 2015-11-22T03:51:53Z