[Issue 19129] std.typecons.scoped crashes when used on classes that have context
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 30 19:36:58 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19129
Simen Kjaeraas <simen.kjaras at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |simen.kjaras at gmail.com
--- Comment #1 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
This issue is also present in std.conv.emplace (which scoped uses internally).
At least currently, it is impossible to get a good value for the context
pointer:
unittest {
int y;
class C { this(int x) { y = x; } }
create!C();
}
T create(T)() {
// outer function context of foo.__unittest_L1_C1 is
// needed to new nested class foo.__unittest_L1_C1.C
return new T(0);
}
emplace already checks for isInnerClass!T, and should also check for nested,
non-inner classes. std.traits should have a trait that checks for this
(hasContext? isNestedClass sounds like it should include isInnerClass).
--
More information about the Digitalmars-d-bugs
mailing list