cppcoreguidelines-pro-type-union-access
According to https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md using union for type-punning is undefined behaviour. Replace it with std::memcpy
This commit is contained in:
@@ -96,8 +96,7 @@ PyObject* VectorPy::__reduce__(PyObject *args)
|
||||
|
||||
Py::Tuple tuple(2);
|
||||
|
||||
union PyType_Object pyType = {&VectorPy::Type};
|
||||
Py::Object type(pyType.o);
|
||||
Py::Object type(Base::getTypeAsObject(&Base::VectorPy::Type));
|
||||
tuple.setItem(0, type);
|
||||
|
||||
Base::Vector3d v = this->value();
|
||||
|
||||
Reference in New Issue
Block a user