Bug 8663 – AliasThis is not used in comparison

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-09-15T04:48:04Z
Last change time
2022-09-08T09:11:15Z
Assigned to
No Owner
Creator
Robik
See also
https://issues.dlang.org/show_bug.cgi?id=16633, https://issues.dlang.org/show_bug.cgi?id=5380

Comments

Comment #0 by szadows — 2012-09-15T04:48:04Z
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.
Comment #3 by bugzilla — 2018-11-19T11:05:57Z
Comment #4 by bugzilla — 2018-11-19T11:07:18Z
This is another facet of https://issues.dlang.org/show_bug.cgi?id=5380 I'm not sure we should be 'fixing' this.
Comment #5 by razvan.nitu1305 — 2022-09-08T09:11:15Z
*** This issue has been marked as a duplicate of issue 5380 ***