Bug 20425 – Proxy opCmp fails to compile with types that overloaded opCmp

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Mac OS X
Creation time
2019-12-02T08:21:01Z
Last change time
2019-12-02T23:22:55Z
Keywords
pull
Assigned to
No Owner
Creator
Ali Ak

Comments

Comment #0 by ali.akhtarzada — 2019-12-02T08:21:01Z
import std.datetime, std.typecons; alias M = Typedef!Duration; void main() { auto d1 = 100.msecs; auto d2 = 110.msecs; assert(d1 < d2); auto m1 = M(100.msecs); auto m2 = M(110.msecs); assert(m1 < m2); } /dlang/dmd/linux/bin64/../../src/phobos/std/typecons.d(6736): Error: template std.typecons.Typedef!(Duration, Duration(0L), null).Typedef.Proxy!(Typedef_payload).opCmp cannot deduce function from argument types !()(Duration), candidates are: /dlang/dmd/linux/bin64/../../src/phobos/std/typecons.d(6726): opCmp(this X, B)(auto ref B b) with X = Typedef!(Duration, Duration(0L), null), B = Duration must satisfy one of the following constraints: !is(typeof(a.opCmp(b))) !is(typeof(b.opCmp(a))) /dlang/dmd/linux/bin64/../../src/phobos/std/typecons.d(6736): Error: template std.typecons.Typedef!(Duration, Duration(0L), null).Typedef.Proxy!(Typedef_payload).opCmp cannot deduce function from argument types !()(Duration), candidates are: /dlang/dmd/linux/bin64/../../src/phobos/std/typecons.d(6726): opCmp(this X, B)(auto ref B b) with X = Typedef!(Duration, Duration(0L), null), B = Duration must satisfy one of the following constraints: !is(typeof(a.opCmp(b))) !is(typeof(b.opCmp(a))) onlineapp.d(16): Error: template instance std.typecons.Typedef!(Duration, Duration(0L), null).Typedef.Proxy!(Typedef_payload).opCmp!(Typedef!(Duration, Duration(0L), null), Typedef!(Duration, Duration(0L), null)) error instantiating
Comment #1 by dlang-bot — 2019-12-02T08:52:34Z
@aliak00 updated dlang/phobos pull request #7298 "Fix issue 20425: Remove Proxy.opCmp constraints" fixing this issue: - Fix issue 20425: Remove Proxy.opCmp constraints They fail with types that have an opCmp defined and are value types. https://github.com/dlang/phobos/pull/7298
Comment #2 by dlang-bot — 2019-12-02T23:22:55Z
dlang/phobos pull request #7298 "Fix issue 20425: Remove Proxy.opCmp constraints" was merged into master: - ebfb07daec6e93743ce332b648382dd210794813 by Ali Akhtarzada: Fix issue 20425: Remove Proxy.opCmp constraints They fail with types that have an opCmp defined and are value types. https://github.com/dlang/phobos/pull/7298