From c68113f01664743989a655a00652e0ab27bec714 Mon Sep 17 00:00:00 2001
From: Tobias Leibner <tobias.leibner@uni-muenster.de>
Date: Fri, 18 May 2018 16:27:36 +0200
Subject: [PATCH] [threadstorage] hack around buggy tbb c++11 detection

---
 dune/xt/common/parallel/threadstorage.hh | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/dune/xt/common/parallel/threadstorage.hh b/dune/xt/common/parallel/threadstorage.hh
index 9455980d9..00eb9ddb2 100644
--- a/dune/xt/common/parallel/threadstorage.hh
+++ b/dune/xt/common/parallel/threadstorage.hh
@@ -12,6 +12,19 @@
 #define DUNE_XT_COMMON_PARALLEL_THREADSTORAGE_HH
 
 #if HAVE_TBB
+// Hack to fix compilation with clang as tbb does not detect C++11 feature correctly for clang. Recent versions of TBB
+// allow to set the macro TBB_USE_GLIBCXX_VERSION to the proper version of libstdc++ to fix this issue, see
+// https://www.threadingbuildingblocks.org/docs/help/reference/appendices/known_issues/linux_os.html. For older versions
+// we need the hack below.
+#include <tbb/tbb_config.h>
+#undef __TBB_CPP11_RVALUE_REF_PRESENT
+#undef __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT
+#undef __TBB_CPP11_DECLTYPE_PRESENT
+#undef __TBB_CPP11_LAMBDAS_PRESENT
+#define __TBB_CPP11_RVALUE_REF_PRESENT 1
+#define __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT 1
+#define __TBB_CPP11_DECLTYPE_PRESENT 1
+#define __TBB_CPP11_LAMBDAS_PRESENT 1
 #include <tbb/enumerable_thread_specific.h>
 #endif
 
-- 
GitLab