flexible-collision-library / fcl

Flexible Collision Library
https://flexible-collision-library.github.io/
Other
1.35k stars 415 forks source link

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

Open AdmiralPellaeon opened 1 week ago

AdmiralPellaeon commented 1 week ago

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_primitiveindices) + 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