www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Hum Humm, Typedef

reply Treebeard <treebeard where.org> writes:
Hoom, hum, I met a dark forest of complains from the compilers 
here.

I walk slowly, but I would love typedef and cookies..

"""
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
"""
Nov 30 2019
parent aliak <something something.com> writes:
On Saturday, 30 November 2019 at 18:15:47 UTC, Treebeard wrote:
 Hoom, hum, I met a dark forest of complains from the compilers 
 here.

 [...]
/me thinks it's a bug Pushed a pr. Let's see. https://github.com/dlang/phobos/pull/7298
Dec 01 2019