http://llvm.org/bugs/show_bug.cgi?id=16233

            Bug ID: 16233
           Summary: [-cxx-abi microsoft] Wrong function type for the
                    deleting destructor?
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

In the Itanium ABI, all the destructor types have the same function prototype,
including argument types.

In the Microsoft ABI however the deleting destructor takes an implicit argument
whilst the vbase and "simple" destructor take no extra arguments.

As of r183303, Clang has the wrong function type for the deleting destructor,
see below.

=== test.cpp ===
struct ABC {
  virtual ~ABC() {}
};

void foo() {
  ABC z;
}
================


=== patch to clang ===
Index: lib/AST/MicrosoftMangle.cpp
===================================================================
--- lib/AST/MicrosoftMangle.cpp    (revision 183303)
+++ lib/AST/MicrosoftMangle.cpp    (working copy)
@@ -11,6 +11,8 @@
 //

//===----------------------------------------------------------------------===//

+#include <stdio.h>
+
 #include "clang/AST/Mangle.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Attr.h"
@@ -1187,6 +1189,12 @@
   // <return-type> ::= <type>
   //               ::= @ # structors (they have no declared return type)
   if (IsStructor) {
+    if (isa<CXXDestructorDecl>(D)) {
+      fprintf(stderr, "Dtor type = %s:\n",
+              StructorType == Dtor_Deleting ? "Deleting" : "Complete");
+      D->dump();
+      fprintf(stderr, "\n");
+    }
     if (isa<CXXDestructorDecl>(D) && D == Structor &&
         StructorType == Dtor_Deleting) {
       // The scalar deleting destructor takes an extra int argument.
======================

$ clang++ -cc1 -cxx-abi microsoft -fno-rtti -emit-llvm -o zz test.cpp
Dtor type = Complete:
CXXDestructorDecl 0x59e1c10 <test.cpp:2:3, col:19> ~ABC 'void (void)' virtual
`-CompoundStmt 0x5a16978 <col:18, col:19>

Dtor type = Deleting:
CXXDestructorDecl 0x59e1c10 <test.cpp:2:3, col:19> ~ABC 'void (void)' virtual
`-CompoundStmt 0x5a16978 <col:18, col:19>

-- 
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