[Issue 21073] New: Rebindable does not work when class has alias this to inout property
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jul 25 11:44:27 UTC 2020
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 at puremagic.com
Reporter: freeslave93 at 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- at 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.
--
More information about the Digitalmars-d-bugs
mailing list