Skip to content

Commit 548be4c

Browse files
committedJan 20, 2024
add explicit move constructor to deal with unit test regression test-z3 algebraic on Windows/debug -
it uses copy constructor instead of move when returning a scoped_anum in functions such as power and root. This leads to freeing memory that gets passed as return value. The copy constructor for scoped_numeral is also suspicious because it doesn't ensure memory ownership.
1 parent a2993f7 commit 548be4c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

Diff for: ‎src/util/scoped_numeral.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class _scoped_numeral {
2828
numeral m_num;
2929
public:
3030
_scoped_numeral(Manager & m):m_manager(m) {}
31-
_scoped_numeral(_scoped_numeral const & n):m_manager(n.m_manager) { m().set(m_num, n.m_num); }
32-
_scoped_numeral(_scoped_numeral &&) = default;
31+
_scoped_numeral(_scoped_numeral const& n) :m_manager(n.m_manager) { m().set(m_num, n.m_num); }
32+
_scoped_numeral(_scoped_numeral && n) noexcept: m_manager(n.m_manager) { m().swap(m_num, n.m_num); }
3333
~_scoped_numeral() { m_manager.del(m_num); }
3434

3535
Manager & m() const { return m_manager; }

0 commit comments

Comments
 (0)
Please sign in to comment.