diff --git a/include/pybind11/stl.h b/include/pybind11/stl.h index ab30ecac0..8710de014 100644 --- a/include/pybind11/stl.h +++ b/include/pybind11/stl.h @@ -370,12 +370,19 @@ struct variant_caster> { template bool load_alternative(handle src, bool convert, type_list) { +#if defined(__MINGW32__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif auto caster = make_caster(); if (caster.load(src, convert)) { value = cast_op(std::move(caster)); return true; } return load_alternative(src, convert, type_list{}); +#if defined(__MINGW32__) +# pragma GCC diagnostic pop +#endif } bool load_alternative(handle, bool, type_list<>) { return false; }