Skip to content

Commit 18fcd91

Browse files
authored
fix syntax issue with gcc (ros2#1674)
* fix syntax issue with gcc Signed-off-by: William Woodall <[email protected]> * uncrustify Signed-off-by: William Woodall <[email protected]>
1 parent f245b4c commit 18fcd91

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

rclcpp/include/rclcpp/type_adapter.hpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,22 @@ struct TypeAdapter<T, void, std::enable_if_t<ImplicitTypeAdapter<T>::is_speciali
179179

180180
/// Assigns the custom type implicitly to the given custom type/ros message type pair.
181181
/**
182+
* Note: this macro needs to be used in the root namespace.
183+
* We cannot use ::rclcpp to protect against this, due to how GCC interprets the
184+
* syntax, see: https://stackoverflow.com/a/2781537
185+
*
182186
* \sa TypeAdapter
183187
* \sa ImplicitTypeAdapter
184188
*/
185189
#define RCLCPP_USING_CUSTOM_TYPE_AS_ROS_MESSAGE_TYPE(CustomType, ROSMessageType) \
186190
template<> \
187-
struct ::rclcpp::ImplicitTypeAdapter<CustomType> \
188-
: public ::rclcpp::TypeAdapter<CustomType, ROSMessageType> \
191+
struct rclcpp::ImplicitTypeAdapter<CustomType> \
192+
: public rclcpp::TypeAdapter<CustomType, ROSMessageType> \
189193
{ \
190194
static_assert( \
191195
is_specialized::value, \
192196
"Cannot use custom type as ros type when there is no TypeAdapter for that pair"); \
193-
};
197+
}
194198

195199
} // namespace rclcpp
196200

0 commit comments

Comments
 (0)