From: Francesco Chemolli Date: Thu, 17 Jun 2021 05:07:57 +0000 (+0000) Subject: Fix ClpMap build error on arm32 (#844) X-Git-Tag: SQUID_6_0_1~321 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1fba9ab;p=thirdparty%2Fsquid.git 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. --- 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(); }