Bug 18690 – Can't compare timezones for equality in @safe code

Status
NEW
Severity
minor
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-03-28T20:11:18Z
Last change time
2024-12-01T16:33:19Z
Assigned to
No Owner
Creator
Neia Neutuladh
Moved to GitHub: phobos#10326 →

Comments

Comment #0 by dhasenan — 2018-03-28T20:11:18Z
--- void main() @safe { import std.datetime; auto a = UTC(); auto b = UTC(); assert(a == b); } --- Expected result: the program compiles and runs. The assertion passes. Actual result: tzcomp.d(6): Error: @safe function D main cannot call @system function object.opEquals I worked around this problem by adding a @trusted function that just checks whether a timezone is equal to UTC. This is a part of the general trend that Object.equals isn't inout, but no fix for that is likely to come soon.
Comment #1 by robert.schadek — 2024-12-01T16:33:19Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10326 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB