std.typecons rebindable + tuple with const class gives warning

Saurabh Das saurabh.das at gmail.com
Thu Feb 4 08:16:06 UTC 2021


This code:

void main()
{
     import std.typecons : rebindable, tuple;
     const c = new C();
     auto t = tuple(c.rebindable);
}

class C
{
}

When compiled with DMD 2.095.0 gives a warning:

Warning: struct Rebindable has method toHash, however it cannot 
be called with const(Rebindable!(const(C))) this.

What is causing this? How can this warning be resolved?



More information about the Digitalmars-d-learn mailing list