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 bool
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
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;