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

Fully qualify BlockTestCore::execution to avoid confusion with std::execution #16

Merged
merged 1 commit into from
May 9, 2024

Conversation

traversaro
Copy link
Member

Fix robotology/robotology-superbuild#1646 .

This is a good example on why it is important not too use to much statements such as using namespace std. In blocktest, BlockTestCore::execution is defined, while since C++17 in the STL std::execution is defined.

The problem is hidden until someone includes (even transitively, that I guess it is why at the moment we have this feature only on a specific macos image) the <algorithm> headers that defines std::execution, and then you get errors like:

2024-05-09T02:39:26.7202600Z [5/31] Building CXX object CMakeFiles/blocktestyarpplugins.dir/src/actionCanWrite.cpp.o
2024-05-09T02:39:26.8205630Z FAILED: CMakeFiles/blocktestyarpplugins.dir/src/actionCanWrite.cpp.o 
2024-05-09T02:39:26.9219240Z /Users/runner/miniconda3/envs/test/bin/x86_64-apple-darwin13.4.0-clang++ -DBOOST_ATOMIC_DYN_LINK -DBOOST_ATOMIC_NO_LIB -DBOOST_FILESYSTEM_DYN_LINK -DBOOST_FILESYSTEM_NO_LIB -DBOOST_SYSTEM_DYN_LINK -DBOOST_SYSTEM_NO_LIB -Dblocktestyarpplugins_EXPORTS -I/Users/runner/work/robotology-superbuild/robotology-superbuild/b/src/blocktest-yarp-plugins -I/Users/runner/work/robotology-superbuild/robotology-superbuild/src/blocktest-yarp-plugins/src -I/Users/runner/work/robotology-superbuild/robotology-superbuild/b/src/blocktest-yarp-plugins/thrift -isystem /Users/runner/work/robotology-superbuild/robotology-superbuild/b/install/include/blocktestcore -isystem /Users/runner/work/robotology-superbuild/robotology-superbuild/b/install/include -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem /Users/runner/miniconda3/envs/test/include -Wall -Wextra -O3 -DNDEBUG -std=gnu++17 -isysroot /Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -fPIC -MD -MT CMakeFiles/blocktestyarpplugins.dir/src/actionCanWrite.cpp.o -MF CMakeFiles/blocktestyarpplugins.dir/src/actionCanWrite.cpp.o.d -o CMakeFiles/blocktestyarpplugins.dir/src/actionCanWrite.cpp.o -c /Users/runner/work/robotology-superbuild/robotology-superbuild/src/blocktest-yarp-plugins/src/actionCanWrite.cpp
2024-05-09T02:39:27.0209090Z /Users/runner/work/robotology-superbuild/robotology-superbuild/src/blocktest-yarp-plugins/src/actionCanWrite.cpp:40:1: error: reference to 'execution' is ambiguous
2024-05-09T02:39:27.1209330Z execution ActionCanWrite::execute(const TestRepetitions& testrepetition)
2024-05-09T02:39:27.2210170Z ^
2024-05-09T02:39:27.3212920Z /Users/runner/work/robotology-superbuild/robotology-superbuild/b/install/include/blocktestcore/type.h:65:12: note: candidate found by name lookup is 'BlockTestCore::execution'
2024-05-09T02:39:27.4212430Z enum class execution
2024-05-09T02:39:27.5213500Z            ^
2024-05-09T02:39:27.6216620Z /Users/runner/miniconda3/envs/test/bin/../include/c++/v1/__type_traits/is_execution_policy.h:39:11: note: candidate found by name lookup is 'std::execution'
2024-05-09T02:39:27.7216070Z namespace execution {
2024-05-09T02:39:27.8217460Z           ^
2024-05-09T02:39:27.9220900Z /Users/runner/work/robotology-superbuild/robotology-superbuild/src/blocktest-yarp-plugins/src/actionCanWrite.cpp:52:16: error: reference to 'execution' is ambiguous
2024-05-09T02:39:28.0220540Z         return execution::continueexecution;
2024-05-09T02:39:28.1221880Z                ^
2024-05-09T02:39:28.2224610Z /Users/runner/work/robotology-superbuild/robotology-superbuild/b/install/include/blocktestcore/type.h:65:12: note: candidate found by name lookup is 'BlockTestCore::execution'
2024-05-09T02:39:28.3224220Z enum class execution
2024-05-09T02:39:28.4225190Z            ^
2024-05-09T02:39:28.5227630Z /Users/runner/miniconda3/envs/test/bin/../include/c++/v1/__type_traits/is_execution_policy.h:39:11: note: candidate found by name lookup is 'std::execution'
2024-05-09T02:39:28.6226860Z namespace execution {
2024-05-09T02:39:28.7227830Z           ^
2024-05-09T02:39:28.8230120Z /Users/runner/work/robotology-superbuild/robotology-superbuild/src/blocktest-yarp-plugins/src/actionCanWrite.cpp:111:12: error: reference to 'execution' is ambiguous
2024-05-09T02:39:28.9230430Z     return execution::continueexecution;
2024-05-09T02:39:29.0231810Z            ^
2024-05-09T02:39:29.1236500Z /Users/runner/work/robotology-superbuild/robotology-superbuild/b/install/include/blocktestcore/type.h:65:12: note: candidate found by name lookup is 'BlockTestCore::execution'
2024-05-09T02:39:29.2239410Z enum class execution
2024-05-09T02:39:29.3240670Z            ^
2024-05-09T02:39:29.4243270Z /Users/runner/miniconda3/envs/test/bin/../include/c++/v1/__type_traits/is_execution_policy.h:39:11: note: candidate found by name lookup is 'std::execution'
2024-05-09T02:39:29.5242920Z namespace execution {
2024-05-09T02:39:29.6252030Z           ^
2024-05-09T02:39:29.7253920Z 3 errors generated.

A more complete cleanup would be to try to avoid using namespace std, but at first I got a simple fix to the CI happy again.

@Nicogene Nicogene merged commit 47b471f into robotology:master May 9, 2024
5 checks passed
@Nicogene
Copy link
Member

Nicogene commented May 9, 2024

Merged, thanks!

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.

CI Failure on macOS 12 conda
2 participants