From d617f5efe5154f52904a6a5c66c75d30cad3f02c Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Fri, 28 Nov 2025 16:31:56 -0800 Subject: [PATCH] Work around GCC -Warray-bounds false positive in argument_vector --- include/pybind11/cast.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 2f52479041..5ecded36f7 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -2162,6 +2162,11 @@ class argument_loader { template bool load_impl_sequence(function_call &call, index_sequence) { + PYBIND11_WARNING_PUSH +#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ >= 13 + // Work around a GCC -Warray-bounds false positive in argument_vector usage. + PYBIND11_WARNING_DISABLE_GCC("-Warray-bounds") +#endif #ifdef __cpp_fold_expressions if ((... || !std::get(argcasters).load(call.args[Is], call.args_convert[Is]))) { return false; @@ -2173,6 +2178,7 @@ class argument_loader { } } #endif + PYBIND11_WARNING_POP return true; }