-
Notifications
You must be signed in to change notification settings - Fork 248
vsg::Object cast<T>() sometimes returns nullptr on macOS Sonoma arm64 Release builds #1575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…arm64 Release builds
We need to get to the bottom of why cast<> is failing, not go around relacing all of it's usage across the VSG. Is that are particular object type that is failing? |
I agree... I did, but I couldn't find anything. The object type is uintArray, here VulkanSceneGraph/src/vsg/text/Font.cpp Line 30 in 28b6b81
|
Could you have a look at this thread, I believe it touches upon the issue you are seeing: It looks like an issue with clang generating different type_info results for different libraries in certain circumstances. At the end of the above thread there are suggestions for solutions. |
… IDs during casting
It works using explicit template instantiation. It resolves the different type_info hash IDs during casting. |
- vsg::Array<vsg::DrawIndexedIndirectCommand> - vsg::Array<vsg::VkGeometryInstance> - cast l.size() to uint32_t in assign() to match parameter type and avoid warnings - rename core/Array.cpp to core/ArrayInstantiations.cpp
Thanks for the changes, I've done a first past review and it feels like a rather heavy handed approach, forcing lots of extra code that we don't need other than for working around a problem with a specific compiler's build settings. The changes would also need to be rolled out to all the other use of templates such as vsg::Value, Array2D, Array3D and perhaps even use of vsg::Inherit. Did you test building as dynamic library? |
…e hatch when desired; drop explicit instantiations - CMake: * BUILD_SHARED_LIBS=OFF (static, Clang) -> by default define VSG_EXPORTS to export Array<T>; if VSG_USE_DYNAMIC_CAST is requested, define VSG_USE_DYNAMIC_CAST instead to switch cast<T>() to dynamic_cast. - Remove ArrayInstantiations.cpp: explicit template instantiations are no longer needed.
Thanks for the review, I’ve reworked this to a minimal fix that targets the actual Clang issue (hidden visibility causing divergent &typeid(Array) across TUs):
If this approach looks good, we can apply the same small change to Value, Array2D/Array3D, etc., as needed, no project-wide mass changes required. Shared libs: not tested, sorry, I have limited time to work on this; in shared builds, we already define the import/export macro, so the type info should be default-visible and typeid stable—no additional changes expected. |
Description
ref_ptr readObject(const char* propertyName)"
Type of change