Skip to content
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

compile error in include\fcl\geometry\bvh\BVH_model-inl.h (problem with signed and unsigned #621

Open
AdmiralPellaeon opened this issue Jun 24, 2024 · 0 comments

Comments

@AdmiralPellaeon
Copy link

AdmiralPellaeon commented Jun 24, 2024

Hi,

I use Visual C++ 2022, v143 toolset, compiler flag C++20.

When trying to compile my FCL code, I get the error "error C4146: unary minus operator applied to unsigned type, result still unsigned" in include\fcl\geometry\bvh\BVH_model-inl.h, line 884 (bvnode->first_child = -((*cur_primitive_indices) + 1);)

Seems the calculation (dereferenced pointer + 1) results in an unsigned int type. Therefore the prefix '-' is an error for the compiler.

Adding an explicit cast (bvnode->first_child = -(static_cast<int>(*cur_primitive_indices) + 1);) helps to solve the issue.

Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant