Skip to content

Commit 8a49288

Browse files
authored
include <algorithm> in tbb/concurrent_queue.h (#280)
libc++ trunk no longer pulls <algorithm> in transitively, so the std::equal used by concurrent_queue/concurrent_bounded_queue operator== fails to resolve on CRAN's clang-trunk checks.
1 parent 16cee7f commit 8a49288

3 files changed

Lines changed: 34 additions & 0 deletions

File tree

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# RcppParallel (development version)
22

3+
* Fixed bundled oneTBB builds with recent libc++, which no longer includes
4+
`<algorithm>` transitively. `tbb/concurrent_queue.h` uses `std::equal` but
5+
did not include it, giving "no member named 'equal' in namespace 'std'" when
6+
compiling `concurrent_bounded_queue.cpp`, as seen on CRAN's clang-trunk
7+
checks. (#280)
8+
39
* Fixed bundled oneTBB builds and downstream compilation with Clang and libc++
410
when targeting macOS 10.12 or earlier, where C++17 aligned allocation is not
511
available. (#219)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Include <algorithm> in concurrent_queue.h, which uses std::equal in the
2+
operator== of both concurrent_queue and concurrent_bounded_queue but relies on
3+
some other header dragging <algorithm> in.
4+
5+
libc++ trunk (as used by CRAN's clang-trunk / clang 23 checks) no longer
6+
provides that transitive include, so building the bundled oneTBB fails with
7+
'no member named equal in namespace std' when compiling
8+
src/tbb/concurrent_bounded_queue.cpp. Sibling containers -- concurrent_vector.h,
9+
concurrent_lru_cache.h -- already include <algorithm> explicitly; this brings
10+
concurrent_queue.h in line.
11+
12+
Not yet fixed upstream as of oneTBB master; drop this once it is.
13+
14+
diff --git a/src/tbb/include/oneapi/tbb/concurrent_queue.h b/src/tbb/include/oneapi/tbb/concurrent_queue.h
15+
index 9d7ec9a2..dd2ff34c 100644
16+
--- a/src/tbb/include/oneapi/tbb/concurrent_queue.h
17+
+++ b/src/tbb/include/oneapi/tbb/concurrent_queue.h
18+
@@ -24,6 +24,8 @@
19+
#include "detail/_containers_helpers.h"
20+
#include "cache_aligned_allocator.h"
21+
22+
+#include <algorithm> // std::equal
23+
+
24+
namespace tbb {
25+
namespace detail {
26+
namespace d2 {

src/tbb/include/oneapi/tbb/concurrent_queue.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#include "detail/_containers_helpers.h"
2525
#include "cache_aligned_allocator.h"
2626

27+
#include <algorithm> // std::equal
28+
2729
namespace tbb {
2830
namespace detail {
2931
namespace d2 {

0 commit comments

Comments
 (0)