<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - exception is not ABI-compatible with libstdc++"
   href="https://bugs.llvm.org/show_bug.cgi?id=49037">49037</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>exception is not ABI-compatible with libstdc++
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>yichen.yan@inf.ethz.ch
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24482" name="attach_24482" title="make run">attachment 24482</a> <a href="attachment.cgi?id=24482&action=edit" title="make run">[details]</a></span>
make run

If I'm not mistaken,

<span class="quote">> ABI compatibility with gcc's libstdc++ for some low-level features such as exception objects...</span >
means that we can use libraries compiled with libstdc++ with libc++ and the
exception works well.


I found the case that try-catch statement is not working as expected, which
seems due to some ABI issue.

root@10155041665b:/test# make run
g++ -c lib.cc -fpic -o lib.o```
g++ -nostdinc++ -I/libcxx-install-11/include/c++/v1 -nodefaultlibs
-L/libcxx-install-11/lib -lc++ -lc++abi -lm -lc -lgcc_s -lgcc \
main.cc lib.o -o a.out
LD_LIBRARY_PATH=/libcxx-install-11/lib ./a.out
2
root@10155041665b:/test# cat main.cc 
#include <iostream>

#include "lib.h"

int main() {
    try {
        throw gen();
    } catch (const e& exp) {
        std::cout << 1 << std::endl;
    } catch (...) {
        std::cout << 2 << std::endl;
    }
}
root@10155041665b:/test# cat lib.cc 
#include "lib.h"

std::runtime_error gen() {
    return e("");
}
root@10155041665b:/test# cat lib.h 
#include <stdexcept>

struct e : public std::runtime_error {
    explicit e(const char* what) :
        std::runtime_error(what) {
    }
};

std::runtime_error gen();</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>