From bbb0ca7b53873b1171a371f2b3095fa39fcd282e Mon Sep 17 00:00:00 2001 From: Tim Ohliger Date: Fri, 10 Jan 2025 11:30:45 +0100 Subject: [PATCH] Added cast to prevent error with MSVC --- include/pybind11/typing.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pybind11/typing.h b/include/pybind11/typing.h index 6660855bbc..c5f342aed0 100644 --- a/include/pybind11/typing.h +++ b/include/pybind11/typing.h @@ -262,7 +262,7 @@ consteval auto sanitize_string_literal() { constexpr std::string_view v(StrLit.name); constexpr std::string_view special_chars("!@%{}-"); constexpr auto num_special_chars = std::accumulate( - special_chars.begin(), special_chars.end(), 0, [&v](auto acc, const char &c) { + special_chars.begin(), special_chars.end(), (size_t) 0, [&v](auto acc, const char &c) { return std::move(acc) + std::ranges::count(v, c); }); char result[v.size() + num_special_chars + 1];