mirror of
https://github.com/RYDE-WORK/pybind11.git
synced 2026-01-19 13:13:19 +08:00
Remove some maybe-uninitialized warnings (#5516)
* Remove some maybe-uninitialized warnings In the Eigen matrix type_caster, resize the matrix instead of assigning with a new one when the matrix size needs to be adjusted. This can remove lots of compiling warnings about "maybe-uninitialized". * Revert "Remove some maybe-uninitialized warnings" This reverts commit 7d5a9b41aaf6878f9ff27aa0fb68c6de4a409a01. * Suppress `-Wmaybe-uninitialized` warning Reproducer: https://github.com/pybind/pybind11/pull/5516#issuecomment-2645846295 --------- Co-authored-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
This commit is contained in:
parent
d2e7e8c687
commit
31d7c870cf
@ -316,8 +316,11 @@ struct type_caster<Type, enable_if_t<is_eigen_dense_plain<Type>::value>> {
|
||||
return false;
|
||||
}
|
||||
|
||||
PYBIND11_WARNING_PUSH
|
||||
PYBIND11_WARNING_DISABLE_GCC("-Wmaybe-uninitialized") // See PR #5516
|
||||
// Allocate the new type, then build a numpy reference into it
|
||||
value = Type(fits.rows, fits.cols);
|
||||
PYBIND11_WARNING_POP
|
||||
auto ref = reinterpret_steal<array>(eigen_ref_array<props>(value));
|
||||
if (dims == 1) {
|
||||
ref = ref.squeeze();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user