http://d.puremagic.com/issues/show_bug.cgi?id=11161
--- Comment #4 from Jonathan M Davis <jmdavisp...@gmx.com> 2013-10-03 10:55:48 PDT --- > 'alias this' should be considered for operator overloading. If not, sub-typing by using 'alias this' won't work anymore. I would expect sub-typing via alias this to only come into effect when the values being compared were of different types. So, struct S { bool opEquals(ref const S) { return false; } } struct T { S s; int value; alias value this; } void main() { S s1; S s2; int i; //Uses built-in opEquals, because the types match auto result1 = s1 == s2; //Uses alias this because it's not comparing with another S auto result2 = s1 == i; } I don't understand why alias this would even come into effect until you're dealing with a type other than S. As I understand it, alias this is for when the original type doesn't work, in which case the conversion is done if that will work instead. And that doesn't apply here. I'd also expect the compiler to always define a default opEquals for structs if you don't define one. And that's what it does when there's no alias this involved. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------