]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix ClpMap build error on arm32 (#844)
authorFrancesco Chemolli <kinkie@squid-cache.org>
Thu, 17 Jun 2021 05:07:57 +0000 (05:07 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Thu, 17 Jun 2021 15:46:01 +0000 (15:46 +0000)
    static_assert ... "Sum() return type can fit its (unsigned) result"
    in ClpMap member instantiation inside sslCrtvdHandleReplyWrapper()

Honor Sum<T>() 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

index fcccd5904b813db9714d4164a1884f2fb71931fd..49e056339ec680786dad172176197e95f216a679 100644 (file)
@@ -80,8 +80,8 @@ Sum(const T a, const U b) {
 template <typename T, typename... Args>
 Optional<T>
 Sum(const T first, Args... args) {
-    if (const auto others = Sum(args...)) {
-        return Sum(first, others.value());
+    if (const auto others = Sum<T>(args...)) {
+        return Sum<T>(first, others.value());
     } else {
         return Optional<T>();
     }