[llvm-bugs] [Bug 37487] New: Using std::__throw_bad_weak_ptr can produce invalid RTTI for std::runtime_error

via llvm-bugs llvm-bugs at lists.llvm.org
Wed May 16 08:04:47 PDT 2018


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: unassignedclangbugs at nondot.org
          Reporter: davidcapello at gmail.com
                CC: dgregor at apple.com, llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180516/5690c425/attachment-0001.html>


More information about the llvm-bugs mailing list