Skip to content
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

Fix build error with clang #183

Merged

Conversation

luca-della-vedova
Copy link
Contributor

When users try to include the realtime_box_best_effort.h header and build their project with clang the following error will come up (tested on Ubuntu 24.04 and Jazzy):

--- stderr: realtime_tools                              
In file included from /usr/local/google/home/lucadv/ws_control/src/realtime_tools/test/realtime_box_best_effort_tests.cpp:32:
/usr/local/google/home/lucadv/ws_control/src/realtime_tools/include/realtime_tools/realtime_box_best_effort.h:74:54: error: use of class template 'std::initializer_list' requires template arguments
   74 |     std::enable_if_t<std::is_constructible_v<U, std::initializer_list>>)
      |                                                      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/initializer_list:45:11: note: template is declared here
   44 |   template<class _E>
      |   ~~~~~~~~~~~~~~~~~~
   45 |     class initializer_list
      |           ^
1 error generated.

I just added the template argument to the initializer list and this seems to satisfy clang / not break gcc.

Test it!

Just build with the clang mixin before and after this PR:

colcon build --mixin clang

Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.51%. Comparing base (974c89c) to head (14ce701).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #183   +/-   ##
=======================================
  Coverage   75.51%   75.51%           
=======================================
  Files           8        8           
  Lines         343      343           
  Branches       54       54           
=======================================
  Hits          259      259           
  Misses         50       50           
  Partials       34       34           
Flag Coverage Δ
unittests 75.51% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
include/realtime_tools/realtime_box_best_effort.h 87.87% <ø> (ø)

Copy link
Member

@saikishor saikishor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@christophfroehlich christophfroehlich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw the same warning, thx for fixing this!

@christophfroehlich christophfroehlich merged commit 8420811 into ros-controls:master Nov 1, 2024
27 checks passed
@luca-della-vedova luca-della-vedova deleted the luca/clang_build branch November 7, 2024 07:55
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.

5 participants