Re: [eigen] g++ -Wshadow warnings

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


On Mon, 24 Feb 2014, Brad Bell wrote:

Does eigen wish to support the -Wshadow flag on the g++ compiler ?

Yes, why not.

With eigen 3.2.0 and g++ 4.8.2 I get:

In member function
void Eigen::internal::variable_if_dynamic<T, -1>::setValue(T)’:
/home/bradbell/prefix/eigen/include/Eigen/src/Core/util/XprHelper.h:65:28:
warning: declaration of ‘value’ shadows a member of 'this' [-Wshadow]
void setValue(T value) { m_value = value; }

In this instance, a variable (function argument) has the same name as a member function. The risk of confusion seems rather minimal, but it would be nice not to trigger the warning.

There are quite a number of places in the codebase with this issue, not only the one above. You're welcome to prepare a patch to fix these. Alternatively, open a bug at http://eigen.tuxfamily.org/bz/ but in that case you'll have to wait and see whether it will be followed up.


Jitse


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