https://issues.dlang.org/show_bug.cgi?id=19129

Simen Kjaeraas <simen.kja...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kja...@gmail.com

--- Comment #1 from Simen Kjaeraas <simen.kja...@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).

--

Reply via email to