Ordered comparison of function pointer gives compilation error while I was compiling Metamod:Source
Closed this issue · 4 comments
error: ordered comparison of function pointers ('SchemaCollectionManipulatorFn_t' (aka 'void ()(SchemaCollectionManipulatorAction_t, void *, void *, void *)') and 'SchemaCollectionManipulatorFn_t') [-Werror,-Wordered-compare-function-pointers]
return m_pfnManipulator < rhs.m_pfnManipulator;
Cs2 branch
Currently the solution is to use -Wno-ordered-compare-function-pointers
flag, and I'm not sure there are plans on any other fix for this.
Currently the solution is to use
-Wno-ordered-compare-function-pointers
flag, and I'm not sure there are plans on any other fix for this.
Yeah it works after using this flag.
I tried to use using std::less function object which seems to help with compiling. Not sure if its a good practice
return std::less<SchemaCollectionManipulatorFn_t>()(m_pfnManipulator, rhs.m_pfnManipulator);
Well that warning got quite annoying over time, so I've took another look at it, and indeed, std::less
does seem to be working fine, but it requires an inclusion of stl library (specifically <functional>
) which I don't think we want to do. Instead I've just went with a more harsh "fix" and just casted it to void*
which seems to retained its functionality and resolved the warning.