Skip to content

Use of extern(C++) destructor is hidden #22709

Closed

Description

@tim-dlang
extern(C++):
class A
{
    ~this();
}
class B : A
{
}
class C : B
{
    ~this();
}

Output for different DMD versions (using https://run.dlang.org/):
Up to 2.070.2: Success and no output
2.071.2 to 2.078.3: Failure with output: onlineapp.d(6): Error: class onlineapp.B C++ base class A needs at least one virtual function
2.079.1 to 2.080.1: Failure with output: onlineapp.d(6): Error: class onlineapp.B C++ base class A needs at least one virtual function
Since 2.081.2: Failure with output:
onlineapp.d(9): Error: class onlineapp.C use of onlineapp.A.~this() is hidden by C; use alias ~this = A.~this; to introduce base class overload set
onlineapp.d(9): Error: class onlineapp.C use of onlineapp.A.~this() is hidden by C; use alias ~this = A.~this; to introduce base class overload set

The problem does not exist without extern(C++).
The suggestion to use alias ~this = A.~this; is not valid syntax.

Activity

  1. added 2 commits that reference this issue on Apr 13, 2026
    2a824d6
    212e23e
  2. added a commit that references this issue on May 25, 2026
    92a1526
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions