Bug 13074 – Old opCmp requirement for AA keys should be detected

Status
RESOLVED
Resolution
WONTFIX
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-07-08T13:40:49Z
Last change time
2020-03-21T03:56:32Z
Keywords
diagnostic, pull
Assigned to
No Owner
Creator
Kenji Hara
See also
https://issues.dlang.org/show_bug.cgi?id=13179

Comments

Comment #0 by k.hara.pg — 2014-07-08T13:40:49Z
For code migration from 2.065 to 2.066, following code should report diagnostic error. struct S { int x; int y; int opCmp(ref const S other) const { return x < other.x ? -1 : x > other.x ? 1 : 0; } hash_t toHash() const { return x; } } void main() { S s1 = S(1, 1); S s2 = S(1, 2); S s3 = S(2, 1); S s4 = S(2, 2); bool[S] arr; // line 22 arr[s1] = true; arr[s2] = true; arr[s3] = true; arr[s4] = true; import std.stdio; writeln(arr); } For example: test.d(22): Error: AA key type S is now required equality rather than comparison test.d(22): Please define opEquals, or remove it to rely on default memberwise equality Note that, the error should be removed in the future. Because opCmp should have no effect when the struct is used for AA keys.
Comment #1 by k.hara.pg — 2014-07-08T13:46:44Z
Comment #2 by github-bugzilla — 2014-07-09T02:39:22Z
Commit pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/22de6917b800150a662e31da8ec5a8ead0dd65a9 Merge pull request #2313 from 9rnsr/fix13074 Supplemental fix for issue 13074 - Revert "Merge pull request #1827 from WalterBright/add-opCmp"
Comment #3 by github-bugzilla — 2014-07-10T20:26:22Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/70d5539b889bd9a6b073664c989d46f2b35fad7d Supplemental fix for issue 13074 - revert opEquals and add toHash in std.typecons.Tuple https://github.com/D-Programming-Language/phobos/commit/5c6884a1768da64ba95534504d51e3c5e94ecc29 Merge pull request #2314 from 9rnsr/fix13074 Supplemental fix for issue 13074 - revert opEquals and add toHash in std.typecons.Tuple
Comment #4 by github-bugzilla — 2014-07-11T14:47:19Z
Commits pushed to 2.066 at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/bc4d38f9aefc89a7568669fc3cb1070523f6813d Merge pull request #2313 from 9rnsr/fix13074 Supplemental fix for issue 13074 - Revert "Merge pull request #1827 from WalterBright/add-opCmp" https://github.com/D-Programming-Language/phobos/commit/742889a2e514533edd83d9574ee1c721138f23f5 Merge pull request #2314 from 9rnsr/fix13074 Supplemental fix for issue 13074 - revert opEquals and add toHash in std.typecons.Tuple
Comment #5 by github-bugzilla — 2014-07-11T14:50:43Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/11a29600c94a599ea670c8ba1a134a6ea5bcf491 fix Issue 13074 - Old opCmp requirement for AA keys should be detected https://github.com/D-Programming-Language/dmd/commit/8bee69a9262cbd6b47528f8f09e15b70e0a9a605 Merge pull request #3731 from 9rnsr/fix13074 Issue 13074 - Old opCmp requirement for AA keys should be detected
Comment #6 by github-bugzilla — 2014-07-11T15:15:09Z
Commit pushed to 2.066 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/601d4786af647204779488844e50e6906ce43e0d Merge pull request #3731 from 9rnsr/fix13074 Issue 13074 - Old opCmp requirement for AA keys should be detected
Comment #7 by bugzilla — 2014-07-26T06:47:38Z
This should be resolve as invalid, here's the PR to revert it: https://github.com/D-Programming-Language/dmd/pull/3813
Comment #8 by github-bugzilla — 2014-08-21T18:22:05Z
Comment #9 by github-bugzilla — 2014-08-22T08:04:20Z
Comment #10 by b2.temp — 2019-11-24T10:35:08Z
with D1-style operators being deprecated this issue is not relevant anymore.