Skip to content

[Bug] A default copy assignment is not a shortcut to a copy constructor #2412

@topin89

Description

@topin89

Bug report

Required Info:

  • Operating System:
    • Ubuntu 20.04
  • ROS2 Version:
    • Foxy Fitzroy
  • Version or commit hash:
    • from source: output of git checkout 40f4c38103f4329694c53d9b4864cb6580c380d4 (current head of foxy-devel)
  • DDS implementation:
    • shouldn't matter

Steps to reproduce issue

// look at actual assembly of
Observation & operator=(const Observation &) = default; // observation.hpp:65

Expected behavior

It's expected to be a shortcut for explicitly defined copy constructor

Actual behavior

It just copies every fields of the class. No new is called.

Additional information

Pull request is on the way. main branch has similar issues, but I can't make a pull request for that right now.

See this if you doubt that default assignments don't call constructors.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions