Skip to content

Compiler warnings and variable shadowing #59

Closed

Description

@winapiadmin
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp: In lambda function:
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:317:57: error: declaration of 'color' shadows a previous local [-Werror=shadow]
  317 |             auto findRookQS = [&](Square king_sq, Color color) -> Square {
      |                                                   ~~~~~~^~~~~
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:308:20: note: shadowed declaration is here
  308 |         for (Color color : { WHITE, BLACK }) {
      |                    ^~~~~
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp: In lambda function:
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:328:57: error: declaration of 'color' shadows a previous local [-Werror=shadow]
  328 |             auto findRookKS = [&](Square king_sq, Color color) -> Square {
      |                                                   ~~~~~~^~~~~
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:308:20: note: shadowed declaration is here
  308 |         for (Color color : { WHITE, BLACK }) {
      |                    ^~~~~
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp: In instantiation of 'void chess::_Position<T, <template-parameter-1-2> >::doMove(const chess::Move&) [with bool Strict = false; PieceC = chess::PolyglotPiece; <template-parameter-1-2> = void]':
required from here
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:896:1:
  885 | template void _Position<PieceC, void>::doMove<false>(const Move &move); \
      |                                                                      ^
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:64:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<chess::HistoryEntry<chess::PolyglotPiece>, std::allocator<chess::HistoryEntry<chess::PolyglotPiece> > >::size_type' {aka 'long long unsigned int'} [-Wsign-compare]
   64 |         for (int i = 0; i < history.size(); i++)
      |                         ~~^~~~~~~~~~~~~~~~
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp: In instantiation of 'void chess::_Position<T, <template-parameter-1-2> >::doMove(const chess::Move&) [with bool Strict = true; PieceC = chess::PolyglotPiece; <template-parameter-1-2> = void]':
required from here
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:896:1:
  886 | template void _Position<PieceC, void>::doMove<true>(const Move &move); \
      |                                                                     ^
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:64:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<chess::HistoryEntry<chess::PolyglotPiece>, std::allocator<chess::HistoryEntry<chess::PolyglotPiece> > >::size_type' {aka 'long long unsigned int'} [-Wsign-compare]
   64 |         for (int i = 0; i < history.size(); i++)
      |                         ~~^~~~~~~~~~~~~~~~
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp: In instantiation of 'void chess::_Position<T, <template-parameter-1-2> >::doMove(const chess::Move&) [with bool Strict = false; PieceC = chess::EnginePiece; <template-parameter-1-2> = void]':
required from here
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:897:1:
  885 | template void _Position<PieceC, void>::doMove<false>(const Move &move); \
      |                                                                      ^
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:64:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<chess::HistoryEntry<chess::EnginePiece>, std::allocator<chess::HistoryEntry<chess::EnginePiece> > >::size_type' {aka 'long long unsigned int'} [-Wsign-compare]
   64 |         for (int i = 0; i < history.size(); i++)
      |                         ~~^~~~~~~~~~~~~~~~
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp: In instantiation of 'void chess::_Position<T, <template-parameter-1-2> >::doMove(const chess::Move&) [with bool Strict = true; PieceC = chess::EnginePiece; <template-parameter-1-2> = void]':
required from here
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:897:1:
  886 | template void _Position<PieceC, void>::doMove<true>(const Move &move); \
      |                                                                     ^
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:64:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<chess::HistoryEntry<chess::EnginePiece>, std::allocator<chess::HistoryEntry<chess::EnginePiece> > >::size_type' {aka 'long long unsigned int'} [-Wsign-compare]
   64 |         for (int i = 0; i < history.size(); i++)
      |                         ~~^~~~~~~~~~~~~~~~
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp: In instantiation of 'void chess::_Position<T, <template-parameter-1-2> >::doMove(const chess::Move&) [with bool Strict = false; PieceC = chess::ContiguousMappingPiece; <template-parameter-1-2> = void]':
required from here
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:898:1:
  885 | template void _Position<PieceC, void>::doMove<false>(const Move &move); \
      |                                                                      ^
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:64:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<chess::HistoryEntry<chess::ContiguousMappingPiece>, std::allocator<chess::HistoryEntry<chess::ContiguousMappingPiece> > >::size_type' {aka 'long long unsigned int'} [-Wsign-compare]
   64 |         for (int i = 0; i < history.size(); i++)
      |                         ~~^~~~~~~~~~~~~~~~
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp: In instantiation of 'void chess::_Position<T, <template-parameter-1-2> >::doMove(const chess::Move&) [with bool Strict = true; PieceC = chess::ContiguousMappingPiece; <template-parameter-1-2> = void]':
required from here
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:898:1:
  886 | template void _Position<PieceC, void>::doMove<true>(const Move &move); \
      |                                                                     ^
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:64:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<chess::HistoryEntry<chess::ContiguousMappingPiece>, std::allocator<chess::HistoryEntry<chess::ContiguousMappingPiece> > >::size_type' {aka 'long long unsigned int'} [-Wsign-compare]
   64 |         for (int i = 0; i < history.size(); i++)
      |                         ~~^~~~~~~~~~~~~~~~
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp: In instantiation of 'bool chess::_Position<T, <template-parameter-1-2> >::is_insufficient_material(chess::Color) const [with PieceC = chess::PolyglotPiece; <template-parameter-1-2> = void]':
required from 'bool chess::_Position<T, <template-parameter-1-2> >::has_insufficient_material(chess::Color) const [with PieceC = chess::PolyglotPiece; <template-parameter-1-2> = void]'
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.h:473:91:
  473 |     inline bool has_insufficient_material(Color c) const { return is_insufficient_material(c); }
      |                                                                   ~~~~~~~~~~~~~~~~~~~~~~~~^~~
required from 'bool chess::_Position<T, <template-parameter-1-2> >::is_insufficient_material() const [with PieceC = chess::PolyglotPiece; <template-parameter-1-2> = void]'
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.h:475:16:
  475 |         return has_insufficient_material(WHITE) && has_insufficient_material(BLACK);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~
required from here
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:896:1:
  894 | template bool _Position<PieceC, void>::is_insufficient_material() const;
      |                                                                   ^~~~~
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:808:98: warning: unused parameter 'c' [-Wunused-parameter]
  808 | template <typename PieceC, typename T> bool _Position<PieceC, T>::is_insufficient_material(Color c) const {
      |                                                                                            ~~~~~~^
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp: In instantiation of 'bool chess::_Position<T, <template-parameter-1-2> >::is_insufficient_material(chess::Color) const [with PieceC = chess::EnginePiece; <template-parameter-1-2> = void]':
required from 'bool chess::_Position<T, <template-parameter-1-2> >::has_insufficient_material(chess::Color) const [with PieceC = chess::EnginePiece; <template-parameter-1-2> = void]'
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.h:473:91:
  473 |     inline bool has_insufficient_material(Color c) const { return is_insufficient_material(c); }
      |                                                                   ~~~~~~~~~~~~~~~~~~~~~~~~^~~
required from 'bool chess::_Position<T, <template-parameter-1-2> >::is_insufficient_material() const [with PieceC = chess::EnginePiece; <template-parameter-1-2> = void]'
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.h:475:16:
  475 |         return has_insufficient_material(WHITE) && has_insufficient_material(BLACK);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~
required from here
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:897:1:
  894 | template bool _Position<PieceC, void>::is_insufficient_material() const;
      |                                                                   ^~~~~
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:808:98: warning: unused parameter 'c' [-Wunused-parameter]
  808 | template <typename PieceC, typename T> bool _Position<PieceC, T>::is_insufficient_material(Color c) const {
      |                                                                                            ~~~~~~^
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp: In instantiation of 'bool chess::_Position<T, <template-parameter-1-2> >::is_insufficient_material(chess::Color) const [with PieceC = chess::ContiguousMappingPiece; <template-parameter-1-2> = void]':
required from 'bool chess::_Position<T, <template-parameter-1-2> >::has_insufficient_material(chess::Color) const [with PieceC = chess::ContiguousMappingPiece; <template-parameter-1-2> = void]'
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.h:473:91:
  473 |     inline bool has_insufficient_material(Color c) const { return is_insufficient_material(c); }
      |                                                                   ~~~~~~~~~~~~~~~~~~~~~~~~^~~
required from 'bool chess::_Position<T, <template-parameter-1-2> >::is_insufficient_material() const [with PieceC = chess::ContiguousMappingPiece; <template-parameter-1-2> = void]'
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.h:475:16:
  475 |         return has_insufficient_material(WHITE) && has_insufficient_material(BLACK);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~
required from here
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:898:1:
  894 | template bool _Position<PieceC, void>::is_insufficient_material() const;
      |                                                                   ^~~~~
C:/Users/winapiadmin/source/repos/tb_probing_tool/build/_deps/chesslib-src/position.cpp:808:98: warning: unused parameter 'c' [-Wunused-parameter]
  808 | template <typename PieceC, typename T> bool _Position<PieceC, T>::is_insufficient_material(Color c) const {
      |                                                                                            ~~~~~~^

Activity

  1. winapiadmin commented on May 20, 2026

    @winapiadmin
    OwnerAuthor

    Suggest: -Wall -Werror=shadow -Werror=pedantic -Wextra

  2. linked a pull request that will close this issueTiny cleanups #63on May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions