www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Rebindable and alias this to inout property

Consider the following code

import std.typecons;

class Internal
{
}

class Class
{
     inout(Internal) internal() inout {
         return _internal;
     }
     alias internal this;
     Internal _internal;
}

void main(string[] args)
{
     const c = new Class;
     auto r = c.rebindable;
}

When compiling with dmd it reports the error:

/usr/include/dmd/phobos/std/typecons.d(2173): Error: pure 
function 
std.typecons.Rebindable!(const(Class)).Rebindable.RebindableC
mmon!(const(Class), Class, Rebindable!(const(Class))).opAssign cannot call
impure delegate std.typecons.Rebindable!(const(Class)).Rebindable.RebindableC
mmon!(const(Class), Class, Rebindable!(const(Class))).opAssign.__lambda2
/usr/include/dmd/phobos/std/typecons.d(2173): Error:  nogc 
function 
std.typecons.Rebindable!(const(Class)).Rebindable.RebindableC
mmon!(const(Class), Class, Rebindable!(const(Class))).opAssign cannot call
non- nogc delegate std.typecons.Rebindable!(const(Class)).Rebindable.RebindableC
mmon!(const(Class), Class, Rebindable!(const(Class))).opAssign.__lambda2
main.d(20): Error: template instance 
std.typecons.rebindable!(const(Class)) error instantiating

Note that this code was compilable on dmd 2.083.
Should we call it a regression?
Jul 24 2020