From 5f533e21e719699c7f9d7aaa827bee5c69f79950 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= <klinkjak@fjfi.cvut.cz>
Date: Wed, 27 Mar 2019 08:33:55 +0100
Subject: [PATCH] Atomic: workaround due to fucked up const_cast in CUDA
 10.1.105

Fixes #30
---
 src/TNL/Atomic.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/TNL/Atomic.h b/src/TNL/Atomic.h
index 3f0defe5e9..f9b54ca2b7 100644
--- a/src/TNL/Atomic.h
+++ b/src/TNL/Atomic.h
@@ -150,7 +150,10 @@ public:
    {
       // CUDA does not have a native atomic load:
       // https://stackoverflow.com/questions/32341081/how-to-have-atomic-load-in-cuda
-      return const_cast<Atomic*>(this)->fetch_add( 0 );
+
+      // const-cast on pointer fails in CUDA 10.1.105
+//      return const_cast<Atomic*>(this)->fetch_add( 0 );
+      return const_cast<Atomic&>(*this).fetch_add( 0 );
    }
 
    __cuda_callable__
-- 
GitLab