From 7c6844e895618ae7d14549fc35047b20e00ab8f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Thu, 24 May 2018 21:27:13 +0200 Subject: [PATCH] ES/Formats: Work around a GCC bug In old GCC versions, capturing 'this' does not work for some lambdas. The workaround is to not use auto for the parameter (even though the type is obvious). This can be dropped once we require GCC 7. --- Source/Core/Core/IOS/ES/Formats.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/IOS/ES/Formats.cpp b/Source/Core/Core/IOS/ES/Formats.cpp index 2af15c0c70..9585cf5d6f 100644 --- a/Source/Core/Core/IOS/ES/Formats.cpp +++ b/Source/Core/Core/IOS/ES/Formats.cpp @@ -683,14 +683,18 @@ CertReader::CertReader(std::vector&& bytes) : SignedBlobReader(std::move(byt if (!IsSignatureValid()) return; - static constexpr std::array, 4> types{{ + // XXX: in old GCC versions, capturing 'this' does not work for some lambdas. The workaround + // is to not use auto for the parameter (even though the type is obvious). + // This can be dropped once we require GCC 7. + using CertStructInfo = std::tuple; + static constexpr std::array types{{ {SignatureType::RSA4096, PublicKeyType::RSA2048, sizeof(CertRSA4096RSA2048)}, {SignatureType::RSA2048, PublicKeyType::RSA2048, sizeof(CertRSA2048RSA2048)}, {SignatureType::RSA2048, PublicKeyType::ECC, sizeof(CertRSA2048ECC)}, {SignatureType::ECC, PublicKeyType::ECC, sizeof(CertECC)}, }}; - const auto info = std::find_if(types.cbegin(), types.cend(), [this](const auto& entry) { + const auto info = std::find_if(types.cbegin(), types.cend(), [this](const CertStructInfo& entry) { return m_bytes.size() >= std::get<2>(entry) && std::get<0>(entry) == GetSignatureType() && std::get<1>(entry) == GetPublicKeyType(); });