<html>
    <head>
      <base href="https://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 --- - [WinEH] cleanuppad funclets for C++ EH cannot catch exceptions"
   href="https://llvm.org/bugs/show_bug.cgi?id=25162">25162</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[WinEH] cleanuppad funclets for C++ EH cannot catch exceptions
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>LLVM Codegen
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>david.majnemer@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Consider this example:

extern "C" int puts(const char *);
struct HasDtor {
  /*__forceinline*/ ~HasDtor() {
    try {
      throw 2;
    } catch (int) {
      puts("catch ~HasDtor");
    }
  }
};
int main() {
  try {
    HasDtor o;
    throw 1;
  } catch (int) {
    puts("catch main");
  }
}

clang-cl can compile and run this as expected with the __forceinline commented
out, but uncommenting it makes the program call std::terminate at runtime.

Right now our C++ cleanup funclets don't have pointers to cppxdata. It's not
clear to me if we can make cleanup funclets just like catch handlers here,
where the cleanup funclet references the parent xdata table. If we can do that,
then this will be easy.

If cleanup funclets need their own xdata tables, then we have to change things
up a bit.</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>