Thread overview
[Issue 19258] Cannot @disable ~this()
Sep 28, 2018
Nicholas Wilson
Oct 01, 2018
Nicholas Wilson
Oct 19, 2019
Nicholas Wilson
Oct 20, 2019
Vladimir Panteleev
September 22, 2018
https://issues.dlang.org/show_bug.cgi?id=19258

Илья Ярошенко <ilyayaroshenko@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |C++, rejects-valid

--- Comment #1 from Илья Ярошенко <ilyayaroshenko@gmail.com> ---
required for integration with C++

--
September 22, 2018
https://issues.dlang.org/show_bug.cgi?id=19258

--- Comment #2 from Илья Ярошенко <ilyayaroshenko@gmail.com> ---
btw, extern(C++) can be skipped, the issue is valid for extern(D) as well

--
September 28, 2018
https://issues.dlang.org/show_bug.cgi?id=19258

Nicholas Wilson <iamthewilsonator@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |iamthewilsonator@hotmail.co
                   |                            |m

--- Comment #3 from Nicholas Wilson <iamthewilsonator@hotmail.com> ---
I'm not sure what the desired effect of @disabling the destructor is supposed to achieve? If this is for C++ integration either: a) don't declare it or b) if is required to consume a viable slot declare a dummy function.

--
September 30, 2018
https://issues.dlang.org/show_bug.cgi?id=19258

--- Comment #4 from Илья Ярошенко <ilyayaroshenko@gmail.com> ---
(In reply to Nicholas Wilson from comment #3)
> I'm not sure what the desired effect of @disabling the destructor is supposed to achieve? If this is for C++ integration either: a) don't declare it or b) if is required to consume a viable slot declare a dummy function.

The reason is to be sure that a D compiler does not compile ~this at all.

--
October 01, 2018
https://issues.dlang.org/show_bug.cgi?id=19258

--- Comment #5 from Nicholas Wilson <iamthewilsonator@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.

--
October 19, 2019
https://issues.dlang.org/show_bug.cgi?id=19258

Nicholas Wilson <iamthewilsonator@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--
October 20, 2019
https://issues.dlang.org/show_bug.cgi?id=19258

Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dlang-bugzilla@thecybershad
                   |                            |ow.net

--- Comment #6 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
The struct might have other members with destructors. It would be useful to prevent their destructors from being called, so this issue seems valid to me.

--