This program does not compile. I think it should do.
---
struct X {
string m;
alias m this;
bool opEquals(const X s) const {
return true;
}
}
void main() {
X* x = new X("");
assert(*x == "");
}
---
$ dmd --version
DMD64 D Compiler v2.080.1
Copyright (C) 1999-2018 by The D Language Foundation, All Rights Reserved written by Walter Bright
$ dmd test.d
test.d(11): Error: function test.X.opEquals(const(X) s) const is not callable using argument types (string)
test.d(11): cannot pass argument "" of type string to parameter const(X) s
Comment #1 by robert.schadek — 2024-12-13T19:01:52Z