I'm using boost 1.82, and if I use boost::python::raw_function, I get warning C4267 even if I explicitly use size_t.
#include <boost/python.hpp>
#include <iostream>
boost::python::object Speak(boost::python::tuple args, boost::python::dict kwargs) {
std::cout << "Test Speak!\n";
return boost::python::object();
}
class Test {
public:
Test() {}
};
void RegisterFuncs() {
using namespace boost::python;
class_<Test>("Test", no_init)
.def("Speak", raw_function(&Speak, std::size_t{ 2 }));
}
int main()
{
RegisterFuncs();
}
I get this warning:
Boost\include\boost-1_82\boost\python\raw_function.hpp(53,13): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
main.cpp(19,24): message : see reference to function template instantiation 'boost::python::api::object boost::python::raw_function<boost::python::api::object(__cdecl *)(boost::python::tuple,boost::python::dict)>(F,size_t)' being compiled
with
[
F=boost::python::api::object (__cdecl *)(boost::python::tuple,boost::python::dict)
]
I could understand getting this warning if I was doing something like raw_function(&Speak, 2));, but I can't understand how this warning is here even if I explicitly pass in a size_t. This also gives the same warning:
std::size_t two{ 2 };
class_<Test>("Test", no_init)
.def("Speak", raw_function(&Speak, two));
I can disable the warning with #pragma, but I'd rather understand how it's possible that this warning is present and not need to use #pragma.
I'm using Visual studio 2022 with /std:c++latest