From 7ea84f019d455f0a57b60f35365cb697acc0a0d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com>
Date: Thu, 26 Nov 2020 17:42:34 +0100
Subject: [PATCH] Rewrite a few constexpr conditions as a workaround a clang's
 bug

---
 .../node_processor/AffectationProcessor.hpp   | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/language/node_processor/AffectationProcessor.hpp b/src/language/node_processor/AffectationProcessor.hpp
index f408b632f..3f463ba70 100644
--- a/src/language/node_processor/AffectationProcessor.hpp
+++ b/src/language/node_processor/AffectationProcessor.hpp
@@ -614,12 +614,19 @@ class AffectationToTupleProcessor final : public INodeProcessor
             os << v;
             *m_lhs = std::vector<std::string>{os.str()};
           }
-        } else if constexpr ((std::is_same_v<ValueT, TinyVector<1>> or
-                              std::is_same_v<ValueT, TinyMatrix<1>>)and std::is_arithmetic_v<T>) {
-          *m_lhs = std::vector<ValueT>{ValueT{static_cast<double>(v)}};
-        } else if constexpr ((is_tiny_vector_v<ValueT> or is_tiny_matrix_v<ValueT>)and std::is_same_v<T, int64_t>) {
-          Assert(v == 0);
-          *m_lhs = std::vector<ValueT>{ValueT{zero}};
+        } else if constexpr (is_tiny_vector_v<ValueT> or is_tiny_matrix_v<ValueT>) {
+          if constexpr (std::is_same_v<ValueT, TinyVector<1>> and std::is_arithmetic_v<T>) {
+            *m_lhs = std::vector<TinyVector<1>>{TinyVector<1>{static_cast<double>(v)}};
+          } else if constexpr (std::is_same_v<ValueT, TinyMatrix<1>> and std::is_arithmetic_v<T>) {
+            *m_lhs = std::vector<TinyMatrix<1>>{TinyMatrix<1>{static_cast<double>(v)}};
+          } else if constexpr (std::is_same_v<T, int64_t>) {
+            Assert(v == 0);
+            *m_lhs = std::vector<ValueT>{ValueT{zero}};
+          } else {
+            // LCOV_EXCL_START
+            throw ParseError("unexpected error: unexpected right hand side type in affectation", m_node.begin());
+            // LCOV_EXCL_STOP
+          }
         } else {
           // LCOV_EXCL_START
           throw ParseError("unexpected error: unexpected right hand side type in affectation", m_node.begin());
-- 
GitLab