vendredi 3 janvier 2020

Eigen LinSpaced - deprecated-copy warning

In my project, compiler complains on the following (and many other similar) code snippets:

    Eigen::ArrayXf window =
            Eigen::ArrayXf::LinSpaced(2*M + 1, 0, M_PI)
            .head(2*M)
            .sin();

The warning message is long and unreadable so I will not post all of them here. The warning triggered is -Wdeprecated-copy, and the core part of warning message (in my opinion) is in follow

warning: implicitly-declared ‘Eigen::Block<const Eigen::CwiseNullaryOp<Eigen::internal::linspaced_op<float, __vector(4) float>, Eigen::Array<float, -1, 1> >, -1, 1, false>::Block(const Eigen::Block<const Eigen::CwiseNullaryOp<Eigen::internal::linspaced_op<float, __vector(4) float>, Eigen::Array<float, -1, 1> >, -1, 1, false>&)’ is deprecated [-Wdeprecated-copy]
note: because ‘Eigen::Block<const Eigen::CwiseNullaryOp<Eigen::internal::linspaced_op<float, __vector(4) float>, Eigen::Array<float, -1, 1> >, -1, 1, false>’ has user-provided ‘Eigen::BlockImpl<XprType, BlockRows, BlockCols, InnerPanel, Eigen::Dense>& Eigen::BlockImpl<XprType, BlockRows, BlockCols, InnerPanel, Eigen::Dense>::operator=(const Eigen::BlockImpl<XprType, BlockRows, BlockCols, InnerPanel, Eigen::Dense>&) [with XprType = const Eigen::CwiseNullaryOp<Eigen::internal::linspaced_op<float, __vector(4) float>, Eigen::Array<float, -1, 1> >; int BlockRows = -1; int BlockCols = 1; bool InnerPanel = false]’
  830 |     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) \
      |                                                    ^~~~~~~~
/somewhere/Eigen/src/Core/util/Macros.h:842:53: note: in expansion of macro ‘EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR’
  842 | #define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived)
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/somewhere/Eigen/src/Core/Block.h:161:5: note: in expansion of macro ‘EIGEN_INHERIT_ASSIGNMENT_OPERATORS’
  161 |     EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl)

Does this warning lead to an incorrect(unexpected) result? How can I correct my code to eliminate this warning?

Aucun commentaire:

Enregistrer un commentaire