ros2 / rcpputils

Apache License 2.0
32 stars 55 forks source link

Explictly define the default assignment operator for path #155

Closed allsey87 closed 2 years ago

allsey87 commented 2 years ago

I am getting the following warning when compiling with Clang 13.

In file included from path/to/rcpputils/src/filesystem_helper.cpp:39:
path/to/rcpputils/include/rcpputils/filesystem_helper.hpp:94:20: warning: definition of implicit copy assignment operator for 'path' is deprecated because it has a user-declared copy constructor [-Wdeprecated-copy]
  RCPPUTILS_PUBLIC path(const path & p) = default;
                   ^
path/to/rcpputils/src/filesystem_helper.cpp:197:14: note: in implicit copy assignment operator for 'rcpputils::fs::path' first required here
      parent = *it;
             ^
1 warning generated.
---

The warning and solution seem pretty straightforward and it looks like the warning can be resolved by explicitly defining the operator in filesystem_helper.hpp as follows:

RCPPUTILS_PUBLIC path& operator=(const path & ) = default;
aprotyas commented 2 years ago

@allsey87 seems reasonable - could you submit a PR? I can run CI for you.