Open mcaryl-digitalbarriers opened 3 weeks ago
Thank you for reporting this, @mcaryl-digitalbarriers. It seems that the build errors your are getting come from clang-tidy, not from GCC. Have you checked your project's clang-tidy settings (w.r.t. C++17 vs. C++20)?
Good point, my mistake. Thanks for the quick response.
It's a cmake project and we use set(CMAKE_CXX_STANDARD 20)
which, I think, should ensure clang-tidy is getting the same settings. Disabling clang-tidy does allow the build to complete but isn't ideal. We can control which checks clang-tidy performs but clang-diagnostic-error
aren't checks. They come from the clang compiler it is using to check the code. I've had to deal with some of those recently and the only solution I found was to change the code.
I think the bug and fix still stands but the cause is about clang-tidy. That reports LLVM version 10.0.0
.
Summary
We are trying to use
tbb::parallel_for_each
within a project compiled with gcc 9.4.0 within an Ubuntu 20.04 environment. We have been using C++17 and are moving to C++20. tbb was compiling correctly with C++17. However with C++20 we see build errors relating to missingstd::random_access_iterator
. I think this is due to a mistake in dealing with collections in development versions of C++20.Specifically I think the problem is with an if-def in
parallel_for_each.h
:I believe this should be:
Other if-def in this file use the second form to cope with the absence of concepts in development versions of C++20 for gcc 9.4.0. The first form is sufficient for non-development versions of C++20 but not early versions. Making this change fixes the build for me.
Version
define TBB_VERSION_MAJOR 2021
define TBB_VERSION_MINOR 13
define TBB_VERSION_PATCH 0
Environment
Ubuntu 20.04 (within WSL) gcc 9.4.0 It's probably just gcc that's important.
Observed Behavior
Trying to compile:
Build error:
Expected Behavior
Clean build.
Steps To Reproduce
Sorry. I haven't checked this as vcpkg isn't supplying the latest version. It should be visible with the correct compiler gcc 9.4.0 with a simple test program: