From e48e995da2c90e8aaab0a679b4d8c0557dd2642b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= <klinkovsky@mmg.fjfi.cvut.cz>
Date: Thu, 30 Jun 2022 19:00:45 +0200
Subject: [PATCH] Added workaround for a bug in nvcc 11.7

---
 src/UnitTests/Algorithms/distributedScanTest.h | 6 ++++++
 src/UnitTests/Algorithms/scanTest.h            | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/src/UnitTests/Algorithms/distributedScanTest.h b/src/UnitTests/Algorithms/distributedScanTest.h
index 1ba5277d4b..765e2427c4 100644
--- a/src/UnitTests/Algorithms/distributedScanTest.h
+++ b/src/UnitTests/Algorithms/distributedScanTest.h
@@ -17,6 +17,12 @@ using namespace TNL::Algorithms;
 using namespace TNL::Algorithms::detail;
 using namespace TNL::MPI;
 
+// this is a workaround for an nvcc 11.7 bug: it drops the scope of enum class members in template function calls
+#ifdef HAVE_CUDA
+static constexpr auto Inclusive = TNL::Algorithms::detail::ScanType::Inclusive;
+static constexpr auto Exclusive = TNL::Algorithms::detail::ScanType::Exclusive;
+#endif
+
 /*
  * Light check of DistributedArray.
  *
diff --git a/src/UnitTests/Algorithms/scanTest.h b/src/UnitTests/Algorithms/scanTest.h
index 9611d7acd6..fe794ef53f 100644
--- a/src/UnitTests/Algorithms/scanTest.h
+++ b/src/UnitTests/Algorithms/scanTest.h
@@ -15,6 +15,12 @@ using namespace TNL::Arithmetics;
 using namespace TNL::Algorithms;
 using namespace TNL::Algorithms::detail;
 
+// this is a workaround for an nvcc 11.7 bug: it drops the scope of enum class members in template function calls
+#ifdef HAVE_CUDA
+static constexpr auto Inclusive = TNL::Algorithms::detail::ScanType::Inclusive;
+static constexpr auto Exclusive = TNL::Algorithms::detail::ScanType::Exclusive;
+#endif
+
 // test fixture for typed tests
 template< typename Array >
 class ScanTest : public ::testing::Test
-- 
GitLab