I defined
enum_<mytype>("mytype")
.value("one",1)
.value("two",2)
;
in my BOOST_PYTHON_MODULE.
when I expose a class with a function taking a parameter of type mytype (essentially, an int), like:
void myfunc(mytype m) {
...
}
I get the following compiler warning:
dereferencing pointer ‘p.2311’ (or whatever) does break strict-aliasing rules
now, it is just a warning, and the code works perfectly with optimization enabled..
may I safely ignore the warning? am I missing something?
Thank you
It’s hard to say exactly without seeing the warning, but it’s most likely caused by some macros from Python headers. To be safe, compile the code that uses Python (and Boost.Python) with
-fno-strict-aliasing.