Re: opEquals @safe is ignored

2020-05-24 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, May 24, 2020 2:57:28 AM MDT Luis via Digitalmars-d-learn wrote: > Lets take this example code (https://run.dlang.io/is/Vkpx9j) : > > ´´´D > import std; > > void main() > { > } > > class ExampleC > { >int x; >this (int x) @safe >{ > this.x = x; >} > >override

Re: opEquals @safe is ignored

2020-05-24 Thread Simen Kjærås via Digitalmars-d-learn
On Sunday, 24 May 2020 at 08:57:28 UTC, Luis wrote: dmd ignores @trusted or @safe on opEquals, throwing this error : onlineapp.d(27): Error: @safe function onlineapp.__unittest_L24_C7 cannot call @system function object.opEquals An override @system or @trusted function can't be @safe, or I

opEquals @safe is ignored

2020-05-24 Thread Luis via Digitalmars-d-learn
Lets take this example code (https://run.dlang.io/is/Vkpx9j) : ´´´D import std; void main() { } class ExampleC { int x; this (int x) @safe { this.x = x; } override bool opEquals(Object o) const @trusted { if (ExampleC rhs = cast(ExampleC)o) { return this.x == rhs.x;