Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix syntax issue with gcc #1674

Merged
merged 2 commits into from
May 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions rclcpp/include/rclcpp/type_adapter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,22 @@ struct TypeAdapter<T, void, std::enable_if_t<ImplicitTypeAdapter<T>::is_speciali

/// Assigns the custom type implicitly to the given custom type/ros message type pair.
/**
* Note: this macro needs to be used in the root namespace.
* We cannot use ::rclcpp to protect against this, due to how GCC interprets the
* syntax, see: https://stackoverflow.com/a/2781537
*
* \sa TypeAdapter
* \sa ImplicitTypeAdapter
*/
#define RCLCPP_USING_CUSTOM_TYPE_AS_ROS_MESSAGE_TYPE(CustomType, ROSMessageType) \
template<> \
struct ::rclcpp::ImplicitTypeAdapter<CustomType> \
: public ::rclcpp::TypeAdapter<CustomType, ROSMessageType> \
struct rclcpp::ImplicitTypeAdapter<CustomType> \
: public rclcpp::TypeAdapter<CustomType, ROSMessageType> \
{ \
static_assert( \
is_specialized::value, \
"Cannot use custom type as ros type when there is no TypeAdapter for that pair"); \
};
}

} // namespace rclcpp

Expand Down