Files
bitcoin/ci/test
MarcoFalke faf2759c8c test: [refactor] Use reference over ptr to chainman
It does not make sense to use a pointer, when a reference is more
appropriate, especially given that nullptr has been ruled out.

This is also allows to remove the CI workaround to avoid warnings:

```
C++ compiler .......................... GNU 13.0.0, /bin/x86_64-w64-mingw32-g++-posix
...
/ci_container_base/src/test/blockmanager_tests.cpp: In member function ‘void blockmanager_tests::blockmanager_scan_unlink_already_pruned_files::test_method()’:
/ci_container_base/src/test/blockmanager_tests.cpp:63:17: error: possibly dangling reference to a temporary [-Werror=dangling-reference]
   63 |     const auto& chainman = Assert(m_node.chainman);
      |                 ^~~~~~~~
In file included from /ci_container_base/src/streams.h:13,
                 from /ci_container_base/src/dbwrapper.h:11,
                 from /ci_container_base/src/node/blockstorage.h:10,
                 from /ci_container_base/src/test/blockmanager_tests.cpp:8:
/ci_container_base/src/util/check.h:116:49: note: the temporary was destroyed at the end of the full expression ‘inline_assertion_check<true, std::unique_ptr<ChainstateManager>&>(((blockmanager_tests::blockmanager_scan_unlink_already_pruned_files*)this)->blockmanager_tests::blockmanager_scan_unlink_already_pruned_files::<anonymous>.TestChain100Setup::<anonymous>.TestingSetup::<anonymous>.ChainTestingSetup::<anonymous>.BasicTestingSetup::m_node.node::NodeContext::chainman, std::source_location{(& *.Lsrc_loc27)}, std::basic_string_view<char>(((const char*)"m_node.chainman")))’
  116 | #define Assert(val) inline_assertion_check<true>(val, std::source_location::current(), #val)
      |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/ci_container_base/src/test/blockmanager_tests.cpp:63:28: note: in expansion of macro ‘Assert’
   63 |     const auto& chainman = Assert(m_node.chainman);
      |                            ^~~~~~
cc1plus: all warnings being treated as errors
gmake[2]: Leaving directory '/ci_container_base/ci/scratch/build-x86_64-w64-mingw32'
gmake[2]: *** [src/test/CMakeFiles/test_bitcoin.dir/build.make:382: src/test/CMakeFiles/test_bitcoin.dir/blockmanager_tests.cpp.obj] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:1810: src/test/CMakeFiles/test_bitcoin.dir/all] Error 2
gmake[1]: Leaving directory '/ci_container_base/ci/scratch/build-x86_64-w64-mingw32'
gmake: *** [Makefile:146: all] Error 2
```

This false-positive warning is also fixed in later GCC versions.

See also https://godbolt.org/z/fjc6be65M
2025-11-10 13:07:42 +01:00
..
2025-08-26 17:11:45 +01:00
2025-11-04 09:27:12 +00:00