www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18690] New: Can't compare timezones for equality in safe code

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

          Issue ID: 18690
           Summary: Can't compare timezones for equality in  safe code
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: dhasenan gmail.com

---
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.

--
Mar 28 2018