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
Comment #1 by szadows — 2012-09-15T07:12:21Z
Also concerns opCmp.
Comment #2 by yebblies — 2013-01-01T23:15:23Z
This is a dmd issue. Assigning to the alias this expert.