diff --git a/src/api/c++/z3++.h b/src/api/c++/z3++.h index 91ba0c02a..02849ec3d 100644 --- a/src/api/c++/z3++.h +++ b/src/api/c++/z3++.h @@ -3616,12 +3616,12 @@ namespace z3 { } struct scoped_cb { - user_propagator_base* p; - scoped_cb(void* _p, Z3_solver_callback cb):p(static_cast(_p)) { - p->cb = cb; + user_propagator_base& p; + scoped_cb(void* _p, Z3_solver_callback cb):p(*static_cast(_p)) { + p.cb = cb; } ~scoped_cb() { - p->cb = nullptr; + p.cb = nullptr; } };