Bug 9192 – Allow opEquals for .tupleof expressions

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-12-21T07:02:00Z
Last change time
2013-04-04T22:08:40Z
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2012-12-21T07:02:39Z
struct S { this(S rhs) { this.tupleof = rhs.tupleof; } bool opEquals(const ref S rhs) const { return this.tupleof == rhs.tupleof; } int x; } void main() { S s1, s2; assert(s1 == s2); } test.d(12): Error: incompatible types for ((tuple(this.x)) == (tuple(rhs.x))): '(const(int))' and '(const(int))' Since we're allowed to assign to a .tupleof, why not allow comparisons? For one use-case this would make it easy to implement a workaround until Issue 3789 is fixed. Although only the == and != should probably be implemented, < and > don't make much sense.
Comment #1 by k.hara.pg — 2013-04-04T22:08:40Z
*** This issue has been marked as a duplicate of issue 9873 ***