From 69e77dce00c78c1c30ba7d34d5363ddf5c8f25af Mon Sep 17 00:00:00 2001
From: Florian Uhlig <f.uhlig@gsi.de>
Date: Wed, 1 Nov 2023 10:09:26 +0100
Subject: [PATCH] Fix clang compilation error

The used structured bindings are only supported with C++20 and even then there
is a bug in clang with some older version which crash during compilation. The
fix doesn't capture the structured binding.
---
 algo/unpack/Unpack.cxx | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/algo/unpack/Unpack.cxx b/algo/unpack/Unpack.cxx
index 668de3d834..b9560675b5 100644
--- a/algo/unpack/Unpack.cxx
+++ b/algo/unpack/Unpack.cxx
@@ -184,8 +184,17 @@ namespace cbm::algo
     std::vector<fles::MicrosliceDescriptor> msDesc;  // microslice descriptors
     std::vector<const u8*> msContent;                // pointer to microslice content
     auto legalEqIds = GetEqIds(algos);
-    auto [numMs, sizeBytes] =
+
+    //    Workaround a problem for some clang versions
+    //    Capturing structured bindings either is avaialable with C++20
+    //    Obviously GCC supports it already and has no problems but clang or at
+    //    least some clang versions fail during compilation
+    //    auto [numMs, sizeBytes] =
+    //      ParallelInit(ts, subsystem, gsl::make_span(legalEqIds), sys_ver, genericMonitor, msEqIds, msDesc, msContent);
+    std::pair<size_t, size_t> tmp =
       ParallelInit(ts, subsystem, gsl::make_span(legalEqIds), sys_ver, genericMonitor, msEqIds, msDesc, msContent);
+    auto numMs     = tmp.first;
+    auto sizeBytes = tmp.second;
     std::vector<std::vector<Digi>> msDigis(numMs);  // unpacked digis per microslice
     std::vector<Monitor> monitor(numMs);            // unpacking monitoring data per microslice
 
-- 
GitLab