Replacing line 17372 in std.datetime from: @property auto length() const pure nothrow to: @property typeof(end - begin) length() const pure nothrow and adding a trivial destructor: public pure nothrow @safe @nogc ~this() { } and compiling with: dmd src\datetime.d -unittest -main produces the peculiar error: std\datetime.d(17341): Error: function std.datetime.Interval!(TimeOfDay).Interval.end need 'this' to access member end std\datetime.d(17374): called from here: end() std\datetime.d(18699): Error: template instance std.datetime.Interval!(TimeOfDay) error instantiating std\datetime.d(17341): Error: function std.datetime.Interval!(DateTime).Interval.end need 'this' to access member end std\datetime.d(17374): called from here: end() std\datetime.d(18700): Error: template instance std.datetime.Interval!(DateTime) error instantiating std\datetime.d(18685): Error: pure nested function '__invariant63' cannot access mutable data '_begin' std\datetime.d(18685): Error: need 'this' for '_begin' of type 'TimeOfDay' std\datetime.d(18685): Error: pure nested function '__invariant63' cannot access mutable data '_end' std\datetime.d(18685): Error: need 'this' for '_end' of type 'TimeOfDay' See: https://github.com/D-Programming-Language/phobos/pull/2689 for more information. For some reason it only happens on Windows.
Huh? Why is this a bug in Phobos rather than dmd?
(In reply to hsteoh from comment #1) > Huh? Why is this a bug in Phobos rather than dmd? Don't know which it is until it is reduced.
If we merge https://github.com/D-Programming-Language/dmd/pull/4136 then this will be a blocker for the next release as it might get triggered way more often.
The file in question now is std/datetime/interval.d (struct Interval(TP)). Cannot reproduce on Linux. Please verify on Windows and close if not reproducible.