Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Backport #2353 to humble (-Wpessimizing-move in intra_process_manager.hpp)

クローズ 初心者向け
#3,308 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cpp
領域
backend

調査の方向性

experimental/intra_process_manager.hpp の、465 行目と 507 行目で特定されている 2 つの std::move 呼び出しを調べ、rolling の #2353 における対応する変更と比較してください。提供されている ROS Humble/GCC コマンドで警告を再現し、その後、-Wall の下で -Wpessimizing-move 警告が 2 つとも発生せずにヘッダーをビルドできることを確認してください。

索引モデルが issue の本文から書いたものです。

説明

humble still has the two std::move(MessageUniquePtr(ptr, deleter)) calls in experimental/intra_process_manager.hpp (lines 465 and 507 in 16.0.19) that #2353 removed on rolling. Any package that calls Publisher::publish() and builds with -Wall on GCC 13 or newer gets two warnings from the header.

Repro with the ros:humble headers and GCC 15.3:

docker build -t rclcpp-humble-gcc15 - <<'EOF'
FROM ros:humble AS ros
FROM gcc:15
COPY --from=ros /opt/ros/humble /opt/ros/humble
EOF
docker run --rm rclcpp-humble-gcc15 bash -c '
  printf "%s\n" "#include <rclcpp/rclcpp.hpp>" "#include <std_msgs/msg/int32.hpp>" \
    "void f(rclcpp::Publisher<std_msgs::msg::Int32> & p) { p.publish(std_msgs::msg::Int32{}); }" > t.cpp
  g++ -std=c++17 -fsyntax-only -Wall t.cpp \
    $(find /opt/ros/humble/include -mindepth 1 -maxdepth 1 -type d -printf "-I%p ") 2>&1 | grep pessimizing'
intra_process_manager.hpp:465:51: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]
intra_process_manager.hpp:507:68: warning: moving a temporary object prevents copy elision [-Wpessimizing-move]

Dropping the two std::move calls the same way #2353 does silences both. Could it be backported to humble?

主要言語
C++
スター
815
フォーク
572
平均マージ
6日 8時間
マージ済み PR(30日)
20

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ros2/rclcpp のほかの issue

ros2/rclcpp の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。