Make sure a ReferenceStat is set to values of the correct type (#6430)
authorGereon Kremer <gereon.kremer@cs.rwth-aachen.de>
Fri, 23 Apr 2021 13:46:52 +0000 (15:46 +0200)
committerGitHub <noreply@github.com>
Fri, 23 Apr 2021 13:46:52 +0000 (08:46 -0500)
commitf8af16037ecb1b9a3c322fc4ea2821497f8a2225
treebd4078a7c858d3580b3e13e195d1cc8c506b43e4
parentcea1ad700bc4cff0d9fcfb0f14c8908e24bbc8c2
Make sure a ReferenceStat is set to values of the correct type (#6430)

This PR fixes a very subtle issue with setting the values a ReferenceStat refers to.
ReferenceStat::set() would take a variable by const& and then store the pointer to it. When giving it a different, but implicitly convertible, type, the pointer would assume the wrong type and consequently read incorrect values from it.
This PR makes set() a template function that explicitly checks that the given type is the correct one.
As we can only export int64_t to the API, this forces users of ReferenceStat to use int64_t stats.
src/prop/bvminisat/core/Solver.cc
src/prop/bvminisat/core/Solver.h
src/prop/bvminisat/simp/SimpSolver.h
src/prop/minisat/core/Solver.cc
src/prop/minisat/core/Solver.h
src/util/statistics_stats.h