Bug 13719 – std.datetime no longer compiles when trivial destructor is added

Status
NEW
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2014-11-12T20:23:34Z
Last change time
2024-12-13T18:34:47Z
Assigned to
No Owner
Creator
Walter Bright
Moved to GitHub: dmd#18912 →

Comments

Comment #0 by bugzilla — 2014-11-12T20:23:34Z
Adding the line: public pure nothrow @safe @nogc ~this() { } as a member to struct Date, and compiling with -unittest produces the errors: std\datetime.d(19806): Error: template std.datetime.Interval!(Date).Interval.shift cannot deduce function from argument types !()(int, int), candidates are: std\datetime.d(18203): std.datetime.Interval!(Date).Interval.shift(D)(D duration) if (__traits(compiles, begin + duration)) std\datetime.d(19813): Error: template std.datetime.Interval!(Date).Interval.shift cannot deduce function from argument types !()(int, int, AllowDayOverflow), candidates are: std\datetime.d(18203): std.datetime.Interval!(Date).Interval.shift(D)(D duration) if (__traits(compiles, begin + duration)) std\datetime.d(19817): Error: template instance std.datetime.__unittestL19799_294.testInterval!(Interval!(Date)) error instantiating std\datetime.d(19842): Error: template std.datetime.Interval!(Date).Interval.shift cannot deduce function from argument types !()(int), candidates are: std\datetime.d(18203): std.datetime.Interval!(Date).Interval.shift(D)(D duration) if (__traits(compiles, begin + duration)) std\datetime.d(19845): Error: template std.datetime.Interval!(Date).Interval.shift cannot deduce function from argument types !()(int), candidates are: std\datetime.d(18203): std.datetime.Interval!(Date).Interval.shift(D)(D duration) if (__traits(compiles, begin + duration)) std\datetime.d(19895): Error: template std.datetime.Interval!(Date).Interval.expand cannot deduce function from argument types !()(int, int), candidates are: std\datetime.d(18300): std.datetime.Interval!(Date).Interval.expand(D)(D duration, Direction dir = Direction.both) if (__traits(compiles, begin + duration)) std\datetime.d(19903): Error: template std.datetime.Interval!(Date).Interval.expand cannot deduce function from argument types !()(int, int, AllowDayOverflow, Direction), candidates are: std\datetime.d(18300): std.datetime.Interval!(Date).Interval.expand(D)(D duration, Direction dir = Direction.both) if (__traits(compiles, begin + duration)) std\datetime.d(19907): Error: template instance std.datetime.__unittestL19888_296.testInterval!(Interval!(Date)) error instantiating std\datetime.d(19958): Error: template std.datetime.Interval!(Date).Interval.expand cannot deduce function from argument types !()(int), candidates are: This is a blocker for https://github.com/D-Programming-Language/dmd/pull/4136
Comment #1 by hsteoh — 2014-11-12T21:15:05Z
I don't understand, why is this a Phobos bug rather than a dmd bug?
Comment #2 by bugzilla — 2014-11-12T22:18:36Z
(In reply to hsteoh from comment #1) > I don't understand, why is this a Phobos bug rather than a dmd bug? Don't know which it is until it is reduced.
Comment #3 by code — 2014-11-12T23:38:47Z
For some reason it only occurs on Windows.
Comment #4 by code — 2014-11-17T00:19:06Z
I don't see why adding a trivial destructor should break the piece of Phobos code in question (it doesn't use anything that explicitly checks for an elaborate dtor), so it's likely a DMD bug.
Comment #5 by stanislav.blinov — 2021-12-08T17:06:04Z
7 years later, adding the same dtor to Date and building unittests yields this on Linux: Error: `this.__invariant` is not `nothrow` Error: `this.__invariant` is not `nothrow` std/datetime/date.d(2344): Error: template instance `std.datetime.date.Date.opBinary!"-"` error instantiating std/datetime/date.d(2356): instantiated from here: `opBinary!"-"` Error: `this.__invariant` is not `nothrow`
Comment #6 by robert.schadek — 2024-12-13T18:34:47Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18912 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB