Skip to content

[ecl_utilities] Fix maybe-uninitilized error in tests #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: devel
Choose a base branch
from

Conversation

proan
Copy link

@proan proan commented Nov 23, 2024

When building on ROS 2 Jazzy / Ubuntu Noble, ecl_utilities fails when build testing is enabled.

In file included from src/ecl_core/ecl_utilities/src/test/function_objects.cpp:13:
In member function ‘R ecl::BoundUnaryMemberFunction<C, A, R>::operator()() [with C = ecl::utilities::tests::MemberFunctions; A = const int&; R = void]’,
    inlined from ‘virtual void FunctionObjects_boundMemberFunctions_Test::TestBody()’ at src/ecl_core/ecl_utilities/src/test/function_objects.cpp:148:11:
src/ecl_core/ecl_utilities/src/test/../../include/ecl/utilities/function_objects.hpp:769:55: error: ‘<anonymous>’ may be used uninitialized [-Werror=maybe-uninitialized]
  769 |                 return (member_class.*member_function)(argument);
      |                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
src/ecl_core/ecl_utilities/src/test/function_objects.cpp: In member function ‘virtual void FunctionObjects_boundMemberFunctions_Test::TestBody()’:
src/ecl_core/ecl_utilities/src/test/function_objects.cpp:44:14: note: by argument 2 of type ‘const int&’ to ‘void ecl::utilities::tests::MemberFunctions::f(const int&)’ declared here
   44 |         void f(const int &i) {
      |              ^
ecl_core/ecl_utilities/src/test/function_objects.cpp:147:95: note: ‘<anonymous>’ declared here
  147 |     BoundUnaryMemberFunction<MemberFunctions,const int&,void> bmbfo1(&MemberFunctions::f, a, 3);
      |                                                                                               ^
cc1plus: all warnings being treated as errors

It could be a false positive or because the reference to the literal creates a temporary object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant