[Issue 20425] New: Proxy opCmp fails to compile with types that overloaded opCmp
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Dec 2 08:21:01 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20425
Issue ID: 20425
Summary: Proxy opCmp fails to compile with types that
overloaded opCmp
Product: D
Version: D2
Hardware: x86
OS: Mac OS X
Status: NEW
Severity: enhancement
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: ali.akhtarzada at gmail.com
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
--
More information about the Digitalmars-d-bugs
mailing list