From 4143be94805f4a92e781a4c51dcd4d4e3b59b744 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com>
Date: Wed, 21 Apr 2021 20:53:50 +0200
Subject: [PATCH] Fix clang compilation issues and warnings

---
 src/scheme/DiscreteFunctionP0.hpp                 | 3 +++
 src/scheme/DiscreteFunctionP0Vector.hpp           | 3 +++
 tests/test_DiscreteFunctionDescriptorP0.cpp       | 3 ++-
 tests/test_DiscreteFunctionDescriptorP0Vector.cpp | 3 ++-
 4 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/scheme/DiscreteFunctionP0.hpp b/src/scheme/DiscreteFunctionP0.hpp
index fa95c4e1b..df64472fe 100644
--- a/src/scheme/DiscreteFunctionP0.hpp
+++ b/src/scheme/DiscreteFunctionP0.hpp
@@ -19,6 +19,9 @@ class DiscreteFunctionP0 : public IDiscreteFunction
 
   static constexpr HandledItemDataType handled_data_type = HandledItemDataType::value;
 
+  friend class DiscreteFunctionP0<Dimension, std::add_const_t<DataType>>;
+  friend class DiscreteFunctionP0<Dimension, std::remove_const_t<DataType>>;
+
  private:
   std::shared_ptr<const MeshType> m_mesh;
   CellValue<DataType> m_cell_values;
diff --git a/src/scheme/DiscreteFunctionP0Vector.hpp b/src/scheme/DiscreteFunctionP0Vector.hpp
index f4ccc7d3c..d689258f8 100644
--- a/src/scheme/DiscreteFunctionP0Vector.hpp
+++ b/src/scheme/DiscreteFunctionP0Vector.hpp
@@ -22,6 +22,9 @@ class DiscreteFunctionP0Vector : public IDiscreteFunction
 
   static constexpr HandledItemDataType handled_data_type = HandledItemDataType::vector;
 
+  friend class DiscreteFunctionP0Vector<Dimension, std::add_const_t<DataType>>;
+  friend class DiscreteFunctionP0Vector<Dimension, std::remove_const_t<DataType>>;
+
   static_assert(std::is_arithmetic_v<DataType>, "DiscreteFunctionP0Vector are only defined for arithmetic data type");
 
  private:
diff --git a/tests/test_DiscreteFunctionDescriptorP0.cpp b/tests/test_DiscreteFunctionDescriptorP0.cpp
index 3cc11f7d4..2f80bd84e 100644
--- a/tests/test_DiscreteFunctionDescriptorP0.cpp
+++ b/tests/test_DiscreteFunctionDescriptorP0.cpp
@@ -19,7 +19,8 @@ TEST_CASE("DiscreteFunctionDescriptorP0", "[scheme]")
       REQUIRE(descriptor_copy.type() == DiscreteFunctionType::P0);
     }
 
-    DiscreteFunctionDescriptorP0 descriptor_move{std::move(DiscreteFunctionDescriptorP0{})};
+    DiscreteFunctionDescriptorP0 temp;
+    DiscreteFunctionDescriptorP0 descriptor_move{std::move(temp)};
     REQUIRE(descriptor_move.type() == DiscreteFunctionType::P0);
   }
 }
diff --git a/tests/test_DiscreteFunctionDescriptorP0Vector.cpp b/tests/test_DiscreteFunctionDescriptorP0Vector.cpp
index 4aa605ec4..5caa63b23 100644
--- a/tests/test_DiscreteFunctionDescriptorP0Vector.cpp
+++ b/tests/test_DiscreteFunctionDescriptorP0Vector.cpp
@@ -19,7 +19,8 @@ TEST_CASE("DiscreteFunctionDescriptorP0Vector", "[scheme]")
       REQUIRE(descriptor_copy.type() == DiscreteFunctionType::P0Vector);
     }
 
-    DiscreteFunctionDescriptorP0Vector descriptor_move{std::move(DiscreteFunctionDescriptorP0Vector{})};
+    DiscreteFunctionDescriptorP0Vector temp;
+    DiscreteFunctionDescriptorP0Vector descriptor_move{std::move(temp)};
     REQUIRE(descriptor_move.type() == DiscreteFunctionType::P0Vector);
   }
 }
-- 
GitLab