Skip to content

fix: take ConstSharedPtr in the subscription callbacks - #557

Merged
wep21 merged 1 commit into
ANYbotics:rollingfrom
wep21:fix/const-shared-ptr-callbacks
Nov 14, 2026
Merged

wep21 merged 1 commit into
ANYbotics:rollingfrom
wep21:fix/const-shared-ptr-callbacks

Conversation

@wep21

@wep21 wep21 commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

What

Take ConstSharedPtr in the three subscription callbacks of grid_map_visualization and grid_map_demos. Split from #556.

Why

rclcpp deprecates subscription callbacks that take std::shared_ptr<MessageT>. Clang reports the deprecation through the template instantiation from create_subscription(), although the rclcpp headers are system headers, so both packages do not build with -Werror:

rclcpp/any_subscription_callback.hpp:441:7: error: 'set_deprecated<grid_map_msgs::msg::GridMap_<std::allocator<void>>>' is deprecated: use 'void(std::shared_ptr<const MessageT>)' instead [-Werror,-Wdeprecated-declarations]

GCC does not report it, so the Ubuntu CI passes without this change. The callbacks only read the message.

How it was tested

🤖 Generated with Claude Code

rclcpp deprecates subscription callbacks that take
std::shared_ptr<MessageT>. Clang reports the deprecation through the
template instantiation from create_subscription(), although the rclcpp
headers are system headers, so grid_map_visualization and grid_map_demos
do not build with -Werror. GCC does not report it.

The three callbacks only read the message, so they can take
std::shared_ptr<const MessageT>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@wep21
wep21 merged commit 9a27227 into ANYbotics:rolling Nov 14, 2026
5 checks passed
@wep21
wep21 deleted the fix/const-shared-ptr-callbacks branch November 14, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant