We need to use the vcruntime declarations on Windows to avoid an ODR
violation involving rtti.obj, which provides the definition of the runtime function
implementing dynamic_cast and depends on the vcruntime implementations of
bad_cast and bad_typeid.
Details
Diff Detail
- Repository
- rCXX libc++
Event Timeline
I'd like to call attention to http://libcxxabi.llvm.org, specifically the FAQ entry: Why are the destructors for the standard exception classes defined in libc++abi? They're just empty, can't they be defined inline?
Is this really a "fix" or does it just hide the ODR issue?
You're right, there is an ODR issue. I'll see if it can be solved by using the definitions of these classes from vcruntime_typeinfo.h on Windows. Fixing this in the case where _LIBCPP_NO_VCRUNTIME is defined seems more tricky; I'll leave the situation as is there.
I'd like to call attention to http://libcxxabi.llvm.org, specifically the FAQ entry: Why are the destructors for the standard exception classes defined in libc++abi? They're just empty, can't they be defined inline?
I have read that FAQ entry, but it doesn't seem directly applicable on Windows whose ABI uses a string comparison for type_info comparisons.
I think that this is reasonable to unblock the use of libc++ with and without vcruntime headers. The one thing that I wish was slightly cleaner is not your fault.
libcxx/src/typeinfo.cpp | ||
---|---|---|
53 ↗ | (On Diff #130343) | I wish that there was a reasonable way to split this logic up. |