Community
cancel
Showing results for 
Search instead for 
Did you mean: 
139 Views

TBB doesn't enable c++11 features with Clang on Linux

Ubuntu 15.04, Clang 3.6, TBB v 4.4, libstdc++

At least some c++ features are disabled. tbb_config.h incorrectly calculates the __TBB_CPP11_RVALUE_REF_PRESENT. In my case it's diabled. This causes also some other troubles. E.g. tbb::concurrent_bounded_queue::emplace is wrapped with both __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT(value is correct) and the __TBB_CPP11_RVALUE_REF_PRESENT. Since __TBB_CPP11_RVALUE_REF_PRESENT = 0 the emplace  is disabled.

Seems to me the problem is in flag calculation. Here is it (tbb_config.h, line 164 )

#define __TBB_CPP11_RVALUE_REF_PRESENT            (__has_feature(__cxx_rvalue_references__) && (__TBB_GCC_VERSION >= 40300 || _LIBCPP_VERSION))

1) __has_feature(__cxx_rvalue_references__ ) reports yes

2) _LIBCPP_VERSION is false. On Linux by default bstdc++ is used

3) __TBB_GCC_VERSION >= 40300, reports also false. I have Clang 3.6 and it reports gcc v 4.2. Why not to check the clang version directly?

0 Kudos
2 Replies
139 Views

Hello,

You can use the form https://www.threadingbuildingblocks.org/submit-contribution to submit a patch for the fix you think should work for both scenarios.

thank you,
--Vladimir

139 Views

I cannot propose the good patch since I don't know the reason why the check for the rvalue refs is so complicated at the moment. My proposal is to leave actually the single check  (__has_feature(__cxx_rvalue_references__). Such approach was used in the TBB 4.2, also such approach is used in boost::asio. But in TBB 4.4 there are additional conditions. I assume that there are reasons for such complications, but because I have no access to the history of the changes I don't know the background.

Reply