[Issue 19258] Cannot @disable ~this()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 1 01:08:01 UTC 2018


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

--- Comment #5 from Nicholas Wilson <iamthewilsonator at hotmail.com> ---
For structs if no destructor is given then no destructor is compiled.

struct S
{
    this(int i){}
}

extern(C++) S foo()
{
    return S(3);
}

void main()
{
    import std.traits;
    import std.stdio;
    writeln(__traits(allMembers,S)); // Prints: __ctor
}

For classes, inheritance is involved so you can't disable it anyway.

--


More information about the Digitalmars-d-bugs mailing list