From 1fba9abd39680bc9c2804dee42ae4fd75807819d Mon Sep 17 00:00:00 2001 From: Francesco Chemolli Date: Thu, 17 Jun 2021 05:07:57 +0000 Subject: [PATCH] Fix ClpMap build error on arm32 (#844) static_assert ... "Sum() return type can fit its (unsigned) result" in ClpMap member instantiation inside sslCrtvdHandleReplyWrapper() Honor Sum() caller's explicit request to use a specific accumulation type T instead of guessing the right type for inner sum iterations (based on the second, third, etc. arguments) and hitting static assertions when those guesses were wrong because some of those arguments used types smaller than T. This fix also allows Sum() callers to avoid explicit T when the first argument is already the largest one. Callers should not be forced to be explicit at all, but computing the largest type is a complex known TODO outside this fix scope. --- src/SquidMath.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SquidMath.h b/src/SquidMath.h index fcccd5904b..49e056339e 100644 --- a/src/SquidMath.h +++ b/src/SquidMath.h @@ -80,8 +80,8 @@ Sum(const T a, const U b) { template Optional Sum(const T first, Args... args) { - if (const auto others = Sum(args...)) { - return Sum(first, others.value()); + if (const auto others = Sum(args...)) { + return Sum(first, others.value()); } else { return Optional(); } -- 2.39.5