jsk-ros-pkg / jsk_common

common programs for jsk-ros-pkg
42 stars 81 forks source link

auto in lambda is supported from C++14, not C++11 #1782

Closed knorth55 closed 1 year ago

knorth55 commented 1 year ago

auto in lambda is introduced in #1773 . in #1773, auto in lambda is considered to enabled in c++11, but actually it is from c++14 this build error occurs in jsk_pcl_ros because jsk_pcl_ros forces to use -std=c++14 or -std=c++11, -std=c++0x. some robot with gcc, which only supports c++11 not c++14, (i.e. pr1012, fetch15) fails to build jsk_pcl_ros because of this issue.

https://cpprefjp.github.io/lang/cpp14/generic_lambdas.html https://stackoverflow.com/questions/7709894/using-auto-in-a-lambda-function

/home/applications/ros/indigo/src/jsk-ros-pkg/jsk_common/jsk_topic_tools/include/jsk_topic_tools/connection_based_nodelet.h: In member function ?ros::Publisher jsk_topic_tools::ConnectionBasedNodelet::adv
ertise(ros::NodeHandle&, std::string, int, bool)?:
/home/applications/ros/indigo/src/jsk-ros-pkg/jsk_common/jsk_topic_tools/include/jsk_topic_tools/connection_based_nodelet.h:198:24: error: parameter declared ?auto?
         = [this](auto& pub){ connectionCallback(pub); };
                        ^
/home/applications/ros/indigo/src/jsk-ros-pkg/jsk_common/jsk_topic_tools/include/jsk_topic_tools/connection_based_nodelet.h: In lambda function:
/home/applications/ros/indigo/src/jsk-ros-pkg/jsk_common/jsk_topic_tools/include/jsk_topic_tools/connection_based_nodelet.h:198:49: error: ?pub? was not declared in this scope
         = [this](auto& pub){ connectionCallback(pub); };
                                                 ^
knorth55 commented 1 year ago

this build error is found from nightly workspace build in pr1012 and fetch15.

k-okada commented 1 year ago

Closed via #1785