Closed krisklau closed 5 years ago
This is kind of weird, because, as you mentioned, my compiler doesn't complain about it.
Which compiler are you using?
More surprisingly, the same should be true for the original version of ShapeShfter...
practically speaking I can fix the problem adding mutable to msgBuf_, but I wonder why I have never detected this before
Hmm, thanks for the inputs. Indeed, I find this strange.
Currently I am working on a plugin for plotjuggler, which is also built with catkin.
I got back to a working build with a fresh workspace and upstream plotjuggler (before I had upstream but an old workspace, probably some cmake cache remained after a clean
), so I suspect that my new plugin somehow influenced it. (however no custom compiler flags or anything special in the cmake file). I will try to reproduce in the new workspace. Edit: This at least explains why it triggered on my machine with upstream build.
As far as I can see, nothing actually calls the instantiate
-method? Could that cause the template not to be generated in some cases?
The system is Ubuntu 16.04, default compiler, ros kinetic installed with apt-get.
just pushed a "fix" replacing the old instantiate method with a new one
Update: Reproduced error on fresh workspace and upstream plotjuggler.
Was indeed compiler choice. When compiling with clang-6.0, the errors occurs.
Anyhow, thanks for looking into it and fixing the issue :+1:
Hi,
Regarding the function https://github.com/facontidavide/ros_type_introspection/blob/06c3321fbe256c2c294ba62f3d4479dfb8d6a872/include/ros_type_introspection/utils/shape_shifter.hpp#L78
Note the const qualifier.
I suddenly had trouble compiling PlotJuggler with ROS, giving me build errors of the form:
Which was odd, as I had it compiling fine before, without any obvious changes to my setup. As far as I can understand though, the compiler correctly asserts that accessing the vector data in the implementation
https://github.com/facontidavide/ros_type_introspection/blob/06c3321fbe256c2c294ba62f3d4479dfb8d6a872/include/ros_type_introspection/utils/shape_shifter.hpp#L207
through the
vector<>::data()
function from within the const methodinstantiate
indeed returns the const pointerconst uint8_t*
:https://en.cppreference.com/w/cpp/container/vector/data
Which constructs an IStream object which (for kinetic at least), in serialization.h is not const: http://docs.ros.org/kinetic/api/roscpp_serialization/html/serialization_8h_source.html#l00709
Removing the
const
qualifier frominstantiate
resulted in a working build.Now, obviously there is something with my setup that triggers this now as I had it building before and no one else has had this issue compiling introspection or plotjuggler. However, should this method really be const?
Best, Kristian