[clang] Fix for OpenMP offloading compilation error with GNU++20 option when using complex header (PR #115306)

via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 8 08:35:58 PST 2024


================
@@ -64,8 +64,13 @@ template <class _Tp> __DEVICE__ _Tp norm(const std::complex<_Tp> &__c) {
 }
 
 // conj
-
-template <class _Tp> std::complex<_Tp> conj(const std::complex<_Tp> &__c) {
+#ifdef _GLIBCXX20_CONSTEXPR
+#define CXX20_CONSTEXPR_DEVICE __DEVICE__
----------------
chandraghale wrote:

@shiltian I followed the existing approach used to define constexpr for handling OpenMP offloading in this wrapper. The __DEVICE__ macro indeed looks better suited with GPU offloading environments. 

https://github.com/llvm/llvm-project/pull/115306


More information about the cfe-commits mailing list