From 9a75c06cd9d94d3fd13c47a01044da97b98cf26b Mon Sep 17 00:00:00 2001 From: Artem Belevich Date: Fri, 21 May 2021 10:53:28 -0700 Subject: [PATCH] [CUDA] Work around compatibility issue with libstdc++ 11.1.0 libstdc++ redeclares __failed_assertion multiple times and that results in the function declared with conflicting set of attributes when we include with __host__ __device__ attributes force-applied to all functions. In order to work around the issue, we rename __failed_assertion within the region with forced attributes. See https://bugs.llvm.org/show_bug.cgi?id=50383 for the details. Differential Revision: https://reviews.llvm.org/D102936 --- clang/lib/Headers/cuda_wrappers/complex | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/clang/lib/Headers/cuda_wrappers/complex b/clang/lib/Headers/cuda_wrappers/complex index 11d40a82a8f6..e6805b6044e9 100644 --- a/clang/lib/Headers/cuda_wrappers/complex +++ b/clang/lib/Headers/cuda_wrappers/complex @@ -72,8 +72,16 @@ #define _GLIBCXX_USE_C99_COMPLEX 0 #define _GLIBCXX_USE_C99_COMPLEX_TR1 0 +// Work around a compatibility issue with libstdc++ 11.1.0 +// https://bugs.llvm.org/show_bug.cgi?id=50383 +#pragma push_macro("__failed_assertion") +#if _GLIBCXX_RELEASE == 11 +#define __failed_assertion __cuda_failed_assertion +#endif + #include_next +#pragma pop_macro("__failed_assertion") #pragma pop_macro("_GLIBCXX_USE_C99_COMPLEX_TR1") #pragma pop_macro("_GLIBCXX_USE_C99_COMPLEX")