Horrible workaround for libc++
Libc++ appears to have a problem with dynamic_casting between types where one of them is a template that has been forward declared. This is the only case that I see this problem coming up. Due to the existing interdependencies between header files, I *must* forward declare the Assignable_Proxy_Function_Impl. I don't see any other way around this than to work around the standard library bug.
This commit is contained in:
@@ -136,6 +136,14 @@ namespace chaiscript
|
|||||||
{
|
{
|
||||||
return data;
|
return data;
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef CHAISCRIPT_LIBCPP
|
||||||
|
if (std::string(typeid(To).name()).find("Assignable_Proxy_Function") != std::string::npos) {
|
||||||
|
auto from = detail::Cast_Helper<std::shared_ptr<From> >::cast(t_from, nullptr);
|
||||||
|
if (std::string(typeid(*from).name()).find("Assignable_Proxy_Function_Impl") != std::string::npos) {
|
||||||
|
return std::static_pointer_cast<To>(from);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Reference in New Issue
Block a user