[Issue 18690] New: Can't compare timezones for equality in @safe code
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Mar 28 20:11:18 UTC 2018
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 at puremagic.com
Reporter: dhasenan at 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.
--
More information about the Digitalmars-d-bugs
mailing list