<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - [-cxx-abi microsoft] Wrong function type for the deleting destructor?"
   href="http://llvm.org/bugs/show_bug.cgi?id=16233">16233</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[-cxx-abi microsoft] Wrong function type for the deleting destructor?
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>timurrrr@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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></pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>