digitalmars.D.bugs - [Issue 21073] New: Rebindable does not work when class has alias
- d-bugmail puremagic.com (47/47) Jul 25 2020 https://issues.dlang.org/show_bug.cgi?id=21073
https://issues.dlang.org/show_bug.cgi?id=21073 Issue ID: 21073 Summary: Rebindable does not work when class has alias this to inout property Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: regression Priority: P1 Component: phobos Assignee: nobody puremagic.com Reporter: freeslave93 gmail.com 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 (2.093.0) it reports the error: /usr/include/dmd/phobos/std/typecons.d(2173): Error: pure function std.typecons.Rebindable!(const(Class)).Rebindable.RebindableCommon!(const(Class), Class, Rebindable!(const(Class))).opAssign cannot call impure delegate std.typecons.Rebindable!(const(Class)).Rebindable.RebindableCommon!(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.RebindableCommon!(const(Class), Class, Rebindable!(const(Class))).opAssign cannot call non- nogc delegate std.typecons.Rebindable!(const(Class)).Rebindable.RebindableCommon!(const(Class), Class, Rebindable!(const(Class))).opAssign.__lambda2 main.d(20): Error: template instance std.typecons.rebindable!(const(Class)) error instantiating This code was compilable on dmd 2.083. Current workaround is to add 'pure' attribute to 'internal' method. --
Jul 25 2020