New user self-registration is disabled due to spam. For an account please email bugs-admin@lists.llvm.org with your e-mail address and full name.

Bug 30916 - If a class has indirect private virtual base with non-trivial public destructor, a class cannot access virtual base's destructor.
Summary: If a class has indirect private virtual base with non-trivial public destruct...
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: C++ (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-04 07:17 PDT by Ryou Ezoe
Modified: 2018-07-04 17:55 PDT (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ryou Ezoe 2016-11-04 07:17:02 PDT
If a class has indirect private virtual base with non-trivial public destructor, a class cannot access its virtual base's destructor.

Example code:

struct A
{
    ~A(){}
};
 
struct B: virtual private A
{
    ~B() {}
};
 
struct C: public B
{
    ~C() {}
};

Result:

prog.cc:11:8: error: inherited virtual base class 'A' has private destructor
struct C: public B
       ^
prog.cc:6:11: note: declared private here
struct B: virtual private A

GCC accept this code.
Clang until 3.3 accept this code.
Clang 3.4 and later reject this code.
Comment 1 Taiju Tsuiki 2018-07-04 17:55:33 PDT
This is probably an intended behavior after r183462 to fix DR7.
https://llvm.googlesource.com/clang/+/585bee48bac063f31696e308798f9432b5ba4116
http://www.open-std.org/Jtc1/sc22/wg21/docs/cwg_closed.html#7