[Issue 19129] std.typecons.scoped crashes when used on classes that have context

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 20 09:22:59 UTC 2018


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

--- Comment #2 from Simen Kjaeraas <simen.kjaras at gmail.com> ---
template hasContextPointer(T)
{
    struct S(Fields...)
    {
        Fields f;
    }
    enum fieldSize = S!(typeof(T.tupleof)).sizeof;
    static if (is(T == class))
    {
        enum hasContextPointer = __traits(classInstanceSize, T) > fieldSize +
size_t.sizeof*2 -1;
    }
    else
    {
        enum hasContextPointer = T.sizeof > fieldSize;
    }
}

--


More information about the Digitalmars-d-bugs mailing list