Naios / function2

Improved and configurable drop-in replacement to std::function that supports move only types, multiple overloads and more
http://naios.github.io/function2
Boost Software License 1.0
545 stars 46 forks source link

chore: silence Visual Studio 2022 (17.3.0) warning #53

Closed gjasny closed 2 years ago

gjasny commented 2 years ago

Starting with Visual Studio 2022 (17.3.0) the following warning is emitted:

include\function2\function2.hpp(1176): warning C4305: '<function-style-cast>': truncation from 'bool (__cdecl *)(void)' to 'bool'

Neither bool(callable) (as it was written), nor static_cast<bool>(callable) seem to make the compiler happy. It worked with either !! or omitting it completely.

@Naios

Naios commented 2 years ago

static_cast<bool> is probably the right way to perform this conversion, I'm wondering why MSVC is not happy about it.

mmatisko commented 2 years ago

Hello @Naios, is there any chance to release new patch version of function2 library with this fix? I would like to use it as a Conan package, if needed I could help with PR into conan center repository. Thanks a lot for answer!

Naios commented 2 years ago

@mmatisko I created a new release 4.2.2 that includes this fix, that can be referenced from any package manager. I abadoned conan support though, the recipes are only remaining in this repository to prevent external code from breaking that might reference it. You are free to PR this into the conan center repository, however I won't provide any support for it though.

mmatisko commented 2 years ago

@Naios thank you! I created a PR into Conan center index adding new version of library and I'm gonna also modernize recipe in order to achieve conan v2 support after merge of created PR.