Skip to content

Fix the warning from the same variable name with namespace Eigen

Bong-Hwi Lim requested to merge blim/corryvreckan_main:master into master

The general variable name first and last in the GblTrack.cpp is conflicting with the variable name in Eigen

This makes an error when it comes with the CMAKE flag Werror which is declared in the gitlab-ci.yml[1]

It would be great if we can update the variable name and avoid the warning (error).

[ 10%] Building CXX object src/objects/CMakeFiles/CorryvreckanObjects.dir/GblTrack.cpp.o
[ 10%] Building CXX object src/objects/CMakeFiles/CorryvreckanObjects.dir/Pixel.cpp.o
[ 11%] Building CXX object src/objects/CMakeFiles/CorryvreckanObjects.dir/Track.cpp.o
[ 12%] Building CXX object src/objects/CMakeFiles/CorryvreckanObjects.dir/StraightLineTrack.cpp.o
[ 13%] Building CXX object src/objects/CMakeFiles/CorryvreckanObjects.dir/Event.cpp.o
[ 14%] Building CXX object src/objects/CMakeFiles/CorryvreckanObjects.dir/Multiplet.cpp.o
[ 14%] Building CXX object src/objects/CMakeFiles/CorryvreckanObjects.dir/CorryvreckanObjectsDictionary.cxx.o
/Users/blim/ITS/corryvreckan/src/objects/GblTrack.cpp:408:10: error: declaration shadows a variable in namespace 'Eigen' [-Werror,-Wshadow]
    auto last = planes_.end();
         ^
/opt/homebrew/include/eigen3/Eigen/src/Core/util/IndexedViewHelper.h:38:64: note: previous declaration is here
static const symbolic::SymbolExpr<internal::symbolic_last_tag> last; // PLEASE use Eigen::last   instead of Eigen::placeholders::last
                                                               ^
1 error generated.
make[2]: *** [src/objects/CMakeFiles/CorryvreckanObjects.dir/GblTrack.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [src/objects/CMakeFiles/CorryvreckanObjects.dir/all] Error 2
make: *** [all] Error 2

[1] https://gitlab.cern.ch/corryvreckan/corryvreckan/-/blob/master/.gitlab-ci.yml#L28

Merge request reports