[libcxxabi] r344052 - [NFC][unwind] Improve error message when a type has more than one RTTIs
Louis Dionne
ldionne at apple.com
Tue Oct 9 07:55:15 PDT 2018
Author: ldionne
Date: Tue Oct 9 07:55:15 2018
New Revision: 344052
URL: http://llvm.org/viewvc/llvm-project?rev=344052&view=rev
Log:
[NFC][unwind] Improve error message when a type has more than one RTTIs
The "dynamic_cast error 2" error can apparently happen when the same
type (with RTTI) is defined in more than one translation unit, and
those translation units are linked together. This is technically an
ODR violation, but making the error message more obvious is still
helpful.
Modified:
libcxxabi/trunk/src/private_typeinfo.cpp
Modified: libcxxabi/trunk/src/private_typeinfo.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/private_typeinfo.cpp?rev=344052&r1=344051&r2=344052&view=diff
==============================================================================
--- libcxxabi/trunk/src/private_typeinfo.cpp (original)
+++ libcxxabi/trunk/src/private_typeinfo.cpp Tue Oct 9 07:55:15 2018
@@ -651,7 +651,7 @@ __dynamic_cast(const void *static_ptr, c
// We get here only if there is some kind of visibility problem
// in client code.
syslog(LOG_ERR, "dynamic_cast error 1: Both of the following type_info's "
- "should have public visibility. At least one of them is hidden. %s"
+ "should have public visibility. At least one of them is hidden. %s"
", %s.\n", static_type->name(), dynamic_type->name());
// Redo the search comparing type_info's using strcmp
info = {dst_type, static_ptr, static_type, src2dst_offset, 0};
@@ -674,7 +674,8 @@ __dynamic_cast(const void *static_ptr, c
info.path_dynamic_ptr_to_static_ptr == unknown)
{
syslog(LOG_ERR, "dynamic_cast error 2: One or more of the following type_info's "
- "has hidden visibility. They should all have public visibility. "
+ "has hidden visibility or is defined in more than one translation "
+ "unit. They should all have public visibility. "
"%s, %s, %s.\n", static_type->name(), dynamic_type->name(),
dst_type->name());
// Redo the search comparing type_info's using strcmp
More information about the libcxx-commits
mailing list