Trying to upgrade from TBB 4.1 Update 1 to Update 4, I ran into this error compiling for Linux with Clang:
.../tbb/concurrent_vector.h:667:38: error: conditional expression is ambiguous; 'size_type' (aka 'unsigned long') can be converted to 'atomic<size_type>' and vice versa
return iterator(*this, delta ? internal_grow_by( delta, sizeof(T), &initialize_array, NULL ) : my_early_size);
The solution is simple -- use an expicit cast to size_type on my_early_size to resolve the ambiguity. I don't care whether Clang++ is correct in claiming the ambiguity; I just want to be able to compile TBB with the version of Clang I downloaded a few months ago.
Can someone add this cast to TBB code for the next update? I found similar expressions in 3 other places in the same header and fixed all 4 in my copy.