[LLVMbugs] [Bug 12798] New: Invalid destructor invoked
    bugzilla-daemon at llvm.org 
    bugzilla-daemon at llvm.org
       
    Fri May 11 07:58:37 PDT 2012
    
    
  
http://llvm.org/bugs/show_bug.cgi?id=12798
             Bug #: 12798
           Summary: Invalid destructor invoked
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: asl at math.spbu.ru
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified
Created attachment 8535
  --> http://llvm.org/bugs/attachment.cgi?id=8535
Testcase
Consider the testcase attached.
g++ binary prints:
B::Bar started
B dtor!
A dtor!
A::Bar started
A dtor!
A::Bar finished
B::Bar finished
Foo dtor!
B dtor!
A dtor!
clang++ binary prints:
B::Bar started
Foo dtor!  (*)
B dtor!
A dtor!
A::Bar started
B dtor!
A dtor!
A::Bar finished
B::Bar finished
Foo dtor!  (*)
B dtor!
A dtor!
Note that in clang's case we have extra Foo dtor calls (*). It seems to me that
this is due to clang's not fixing the vtable before pseudo-destructor call and
thus dtor of derived class is invoked instead of dtor of base class.
PS: Note that g++ is also able to devirtualize dtor call here.
-- 
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