From 275a47b92c159d6f9da64de06d6890a318d7c8aa Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sat, 8 Mar 2025 00:52:21 +0100 Subject: [PATCH] sequential_erase: amend the predicate passed to erase_if LWG4135 applies to the quoted Standard paragraph (and therefore to our own code as well). https://cplusplus.github.io/LWG/issue4135 Pick-to: 6.8 Change-Id: I05caa4cba001ecc473412c789738480d8eafa0c5 Reviewed-by: Thiago Macieira (cherry picked from commit 41ffc92f18a1a492720d432f00761e5574076060) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/tools/qcontainertools_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qcontainertools_impl.h b/src/corelib/tools/qcontainertools_impl.h index 7b3c000c3c6..7ce704958aa 100644 --- a/src/corelib/tools/qcontainertools_impl.h +++ b/src/corelib/tools/qcontainertools_impl.h @@ -372,7 +372,7 @@ template auto sequential_erase(Container &c, const T &t) { // use the equivalence relation from http://eel.is/c++draft/list.erasure#1 - auto cmp = [&](auto &e) { return e == t; }; + auto cmp = [&](const auto &e) -> bool { return e == t; }; return sequential_erase_if(c, cmp); // can't pass rvalues! }