Skip to content

Cannot compile nav2_route using clang #6015

@solonovamax

Description

@solonovamax

Bug report

Required Info:

  • Operating System:
    • Arch Linux 6.18.8-arch2-1 x86_64
  • Computer:
    • not sure what you want here. do you want like my CPU or something? I have an AMD Ryzen 3600.
  • ROS2 Version:
    • Compiling Jazzy from source using nix-ros-overlay, with nav2 configured to compile using clang
  • Version or commit hash:
    • 1.3.11-r1
  • DDS implementation:
    • Fast-RTPS
  • Compiler:
    • Clang 19.1.7

Steps to reproduce issue

Try to compile nav2_route using clang

Expected behavior

Does not fail to compile

Actual behavior

Fails to compile with the following message:

In file included from /build/navigation2-release-release-jazzy-nav2_route-1.3.11-1/src/route_server.cpp:15:
/build/navigation2-release-release-jazzy-nav2_route-1.3.11-1/include/nav2_route/route_server.hpp:132:22: error: non-const lvalue reference to type 'ReroutingState' cannot bind to a temporary of type 'ReroutingState'
  132 |     ReroutingState & rerouting_info = ReroutingState());
      |                      ^                ~~~~~~~~~~~~~~~~
/build/navigation2-release-release-jazzy-nav2_route-1.3.11-1/include/nav2_route/route_server.hpp:132:22: note: passing argument to parameter 'rerouting_info' here

Reproduction instructions

Compile using clang.

Additional information

The issue has to do with this function here:

template<typename GoalT>
Route findRoute(
const std::shared_ptr<const GoalT> goal,
ReroutingState & rerouting_info = ReroutingState());

Related: #5660

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions