Skip to content

Commit c2e0043

Browse files
ignore maybe-initialized warning in convert_elements
1 parent 98e50b7 commit c2e0043

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

include/pybind11/stl.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,10 @@ struct list_caster {
326326

327327
bool convert_elements(handle seq, bool convert) {
328328
auto s = reinterpret_borrow<sequence>(seq);
329+
PYBIND11_WARNING_PUSH
330+
#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ >= 13
331+
PYBIND11_WARNING_DISABLE_GCC("-Wmaybe-uninitialized")
332+
#endif
329333
value.clear();
330334
reserve_maybe(s, &value);
331335
for (const auto &it : seq) {
@@ -335,6 +339,7 @@ struct list_caster {
335339
}
336340
value.push_back(cast_op<Value &&>(std::move(conv)));
337341
}
342+
PYBIND11_WARNING_POP
338343
return true;
339344
}
340345

0 commit comments

Comments
 (0)