Re: [eigen] g++ -Wshadow warnings

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


There are too many instances for a quick fix. In the meantime, you can
disable this warning for eigen:

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#include <Eigen/Eigen>
#pragma GCC diagnostic pop

gael.

On Mon, Jun 18, 2012 at 2:51 AM, Brad Bell <bradbell@xxxxxxxxxx> wrote:
> I find the g++ -Wshadow warnings very useful. Unfortunately, one can not use
> them with Eigen programs. For example, comping the simple first program on
> http://eigen.tuxfamily.org/dox/GettingStarted.html
> with g++ -Wshadow I get:
>
> In file included from /home/bradbell/eigen/Eigen/Core:261:0,
> from /home/bradbell/eigen/Eigen/Dense:1,
> from eigen_shadow.cpp:2:
> /home/bradbell/eigen/Eigen/src/Core/util/XprHelper.h: In constructor
> ‘Eigen::internal::variable_if_dynamic<T,
> -0x000000001>::variable_if_dynamic(T)’:
> /home/bradbell/eigen/Eigen/src/Core/util/XprHelper.h:78:43: warning:
> declaration of ‘value’ shadows a member of 'this' [-Wshadow]
> /home/bradbell/eigen/Eigen/src/Core/util/XprHelper.h: In member function
> ‘void Eigen::internal::variable_if_dynamic<T, -0x000000001>::setValue(T)’:
> /home/bradbell/eigen/Eigen/src/Core/util/XprHelper.h:80:28: warning:
> declaration of ‘value’ shadows a member of 'this' [-Wshadow]
> In file included from /home/bradbell/eigen/Eigen/Core:284:0,
> from /home/bradbell/eigen/Eigen/Dense:1,
> from eigen_shadow.cpp:2:
> /home/bradbell/eigen/Eigen/src/Core/DenseCoeffsBase.h: In member function
> ‘void Eigen::DenseCoeffsBase<Derived,
> 1>::writePacket(Eigen::DenseCoeffsBase<Derived, 1>::Index,
> Eigen::DenseCoeffsBase<Derived, 1>::Index, const typename
> Eigen::internal::packet_traits<typename
> Eigen::internal::traits<T>::Scalar>::type&)’:
> /home/bradbell/eigen/Eigen/src/Core/DenseCoeffsBase.h:446:5: warning:
> declaration of ‘x’ shadows a member of 'this' [-Wshadow]
>
> ... snip ...
>
>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/