From eb5489d4f826a4097615f8f60ad5b8d8f613be25 Mon Sep 17 00:00:00 2001 From: Alexey Kukanov Date: Tue, 5 Nov 2024 17:41:05 +0100 Subject: [PATCH] Add a workaround for clang < 14.0 Co-authored-by: Konstantin Boyarinov --- include/oneapi/tbb/blocked_nd_range.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/oneapi/tbb/blocked_nd_range.h b/include/oneapi/tbb/blocked_nd_range.h index 05ca1cdb56..3a9697896f 100644 --- a/include/oneapi/tbb/blocked_nd_range.h +++ b/include/oneapi/tbb/blocked_nd_range.h @@ -68,7 +68,15 @@ class blocked_nd_range_impl> { //! Constructs N-dimensional range over N half-open intervals each represented as tbb::blocked_range. blocked_nd_range_impl(const indexed_t&... args) : my_dims{ {args...} } {} +#if __clang__ && __TBB_CLANG_VERSION < 140000 + // On clang prior to version 14.0.0, passing a single braced init list to the constructor of blocked_nd_range + // matches better on the C array constructor and generates compile-time error because of unexpected size + // Adding constraints for this constructor to force the compiler to drop it from overload resolution if the size is unexpected + template ::type> + blocked_nd_range_impl(const value_type (&size)[M], size_type grainsize = 1) : +#else blocked_nd_range_impl(const value_type (&size)[N], size_type grainsize = 1) : +#endif my_dims { dim_range_type(0, size[Is], grainsize)... } {} //! Dimensionality of a range.