[Issue 21762] object.destroy may silently fail depending on whether a member function is a template

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 24 23:04:47 UTC 2021


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

--- Comment #3 from moonlightsentinel at disroot.org ---
Test case without dependencies:

struct A(T)
{
    ~this()
    {
        static assert(__traits(hasMember, T, "__xdtor"));
    }
}

void main() {
    static struct B {
        A!B next();
        ~this() {}
    }

    static struct C {
        A!C next()();
        ~this() {}
    }

    C().next();
}

B fails while C compiles just fine.

--


More information about the Digitalmars-d-bugs mailing list