yixuan / LBFGSpp

A header-only C++ library for L-BFGS and L-BFGS-B algorithms
https://lbfgspp.statr.me/
MIT License
532 stars 101 forks source link

Some compiler warnings. #36

Closed fire closed 1 year ago

fire commented 1 year ago
modules/lbfgs/thirdparty/../thirdparty/LBFGSpp/include/LBFGSpp/BKLDLT.h: In member function 'int LBFGSpp::BKLDLT<Scalar>::solve_inplace(LBFGSpp::BKLDLT<Scalar>::GenericVector) const':
Error: modules/lbfgs/thirdparty/../thirdparty/LBFGSpp/include/LBFGSpp/BKLDLT.h:523:20: error: declaration of 'i' shadows a previous local [-Werror=shadow]
  523 |         for (Index i = npermc - 1; i >= 0; i--)
      |                    ^
modules/lbfgs/thirdparty/../thirdparty/LBFGSpp/include/LBFGSpp/BKLDLT.h:507:15: note: shadowed declaration is here
  507 |         Index i = (m_perm[m_n - 1] < 0) ? (m_n - 3) : (m_n - 2);
      |               ^
In file included from modules/lbfgs/thirdparty/../thirdparty/LBFGSpp/include/LBFGSB.h:14,
                 from modules/lbfgs/thirdparty/lbfgsbpp.h:39,
                 from modules/lbfgs/register_types.cpp:33:
modules/lbfgs/thirdparty/../thirdparty/LBFGSpp/include/LBFGSpp/LineSearchMoreThuente.h: In static member function 'static int LBFGSpp::LineSearchMoreThuente<Scalar>::LineSearch(Foo&, const SolverParam&, const Vector&, const Vector&, const Scalar&, Scalar&, Scalar&, LBFGSpp::LineSearchMoreThuente<Scalar>::Vector&, Scalar&, LBFGSpp::LineSearchMoreThuente<Scalar>::Vector&)':
Error: modules/lbfgs/thirdparty/../thirdparty/LBFGSpp/include/LBFGSpp/LineSearchMoreThuente.h:415:30: error: declaration of 'ft' shadows a previous local [-Werror=shadow]
  415 |                 const Scalar ft = fx - fx_init - step * test_decr;
      |                              ^~
modules/lbfgs/thirdparty/../thirdparty/LBFGSpp/include/LBFGSpp/LineSearchMoreThuente.h:284:26: note: shadowed declaration is here
  284 |             const Scalar ft = fx - fx_init - step * test_decr;
      |                          ^~
yixuan commented 1 year ago

Thanks for reporting. It has been fixed in https://github.com/yixuan/LBFGSpp/commit/00053e0f24b8bb62e35bfbfe3a7d6feb92b42850.