https://bugs.llvm.org/show_bug.cgi?id=37487

            Bug ID: 37487
           Summary: Using std::__throw_bad_weak_ptr can produce invalid
                    RTTI for std::runtime_error
           Product: clang
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: davidcape...@gmail.com
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org

If we compile a .cpp file with -frtti which throws std::runtime_error and
catches std::exception&, but then we compile another file with -fno-rtti that
uses std::__throw_bad_weak_ptr() in some way and we link both files in one
binary, the final std::runtime_error class is not identified as a derived class
of std::exception (so the catch code is not executed).

Here is a minimal example of this case:
https://gist.github.com/dacap/7ddffbe401eb42620de397e47edfcc76

clang --version
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to