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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to