From 5879eaaf78948d44b8e2b01974e7911c25cde278 Mon Sep 17 00:00:00 2001 From: bresch Date: Fri, 25 Sep 2020 10:49:00 +0200 Subject: [PATCH] ekf: fix variable length array error Even if the non_zeros() function is static constexpr, gcc (10.2) does not like it. Using sizeof...(Idxs) fixes the error. --- EKF/ekf.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/EKF/ekf.h b/EKF/ekf.h index 1aae8fe248..f2cb22ac02 100644 --- a/EKF/ekf.h +++ b/EKF/ekf.h @@ -671,7 +671,8 @@ private: template SquareMatrix24f computeKHP(const Vector24f& K, const SparseVector24f& H) const { SquareMatrix24f KHP; - float KH[H.non_zeros()]; + constexpr size_t non_zeros = sizeof...(Idxs); + float KH[non_zeros]; for (unsigned row = 0; row < _k_num_states; row++) { for(unsigned i = 0; i < H.non_zeros(); i++) { KH[i] = K(row) * H.atCompressedIndex(i);