Demo: http://dpaste.dzfl.pl/72015697 Test case: import std.stdio; void main() { C c = new C("foo"); writeln(c == "foo"); } class C { string v; // This does not work alias v this; this(string val) { v = val; } } Result: testcase.d(8): Error: function object.Object.opEquals (Object lhs, Object rhs) is not callable using argument types (string) testcase.d(8): Error: expected 2 function arguments, not 1
Also concerns opCmp.
This is a dmd issue. Assigning to the alias this expert.
https://github.com/dlang/dmd/pull/8976
This is another facet of https://issues.dlang.org/show_bug.cgi?id=5380 I'm not sure we should be 'fixing' this.
*** This issue has been marked as a duplicate of issue 5380 ***