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;
}
return false;
}
}
@safe unittest
{
auto c = new ExampleC(1);
assert(c != new ExampleC(23));
}
´´´
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 it
a bug ?
Also, how will this be affected by DIP1028 ?