[LLVMbugs] [Bug 7114] New: Clang instantiates implicit virtual destructor too early

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 11 11:30:24 PDT 2010


           Summary: Clang instantiates implicit virtual destructor too
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: dgregor at apple.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
            Blocks: 6023

lackthorn:clang dgregor$ cat t.cpp 
class A { virtual ~A(); };

template<typename T>
class B {
  class Inner : public A { };
  static Inner i;
  static const unsigned value = sizeof(i) == 4;

int f() { return B<int>::value; }
Blackthorn:clang dgregor$ clang++ t.cpp 
t.cpp:6:17: error: base class 'A' has private destructor
  class Inner : public A { };
t.cpp:1:19: note: declared private here
class A { virtual ~A(); };
1 error generated.

Here, we should not be instantiating the implicit, virtual destructor because
it is never "used" (nor is anything that involves the vtable). While this code
is rather sketchy to start with (compilers are allowed to try to instantiate
the virtual member function definitions whenever they want), it happens to be
used in Boost's is_polymorphic type trait, so it has to work. See
Boost.Serialization's test_static_warning test.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list