From 8c93a6573fab029699f5ad58fe741e09a7dbdcbc Mon Sep 17 00:00:00 2001
From: Stephane Del Pino <stephane.delpino44@gmail.com>
Date: Thu, 5 Mar 2020 19:09:25 +0100
Subject: [PATCH] Add workaround dealing with a clang bug

Same bug as previously. Should try again to build a simple reproducer...
---
 src/language/BuiltinFunctionEmbedder.hpp | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/language/BuiltinFunctionEmbedder.hpp b/src/language/BuiltinFunctionEmbedder.hpp
index ae20b1daa..a0fd2514d 100644
--- a/src/language/BuiltinFunctionEmbedder.hpp
+++ b/src/language/BuiltinFunctionEmbedder.hpp
@@ -74,10 +74,14 @@ class BuiltinFunctionEmbedder : public IBuiltinFunctionEmbedder
           } else {
             throw std::runtime_error("unexpected argument types while casting: expecting EmbeddedData");
           }
-        } else if constexpr (std::is_same_v<Ti_Type, FunctionId> and std::is_same_v<Vi_Type, uint64_t>) {
-          std::get<I>(t) = FunctionId{v_i};
-          throw std::runtime_error(
-            "WIP: should get better descriptor, FunctionId should at least refer to the symbol table.");
+        } else if constexpr (std::is_same_v<Ti_Type, FunctionId>) {
+          if constexpr (std::is_same_v<Vi_Type, uint64_t>) {
+            std::get<I>(t) = FunctionId{v_i};
+            throw std::runtime_error(
+              "WIP: should get better descriptor, FunctionId should at least refer to the symbol table.");
+          } else {
+            throw std::runtime_error("unexpected argument types while casting: expecting uint64");
+          }
         } else {
           std::ostringstream os;
           os << "unexpected argument types while casting " << demangle<Vi_Type>() << " -> " << demangle<Ti_Type>()
-- 
GitLab