Skip to content

Commit

Permalink
use const_cast when calling unwindProtect
Browse files Browse the repository at this point in the history
  • Loading branch information
qddyy committed Dec 10, 2024
1 parent 7e978fa commit c16317a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pmt_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class StatFunc : public Function {
template <typename... Args>
auto _invoke(std::true_type, Args&&... args) const
{
return [r_eval = [](void* expr) { return Rf_eval(*static_cast<SEXP*>(expr), R_GlobalEnv); }, r_call = RObject(Rf_lcons(Function(Function::operator()(std::forward<Args>(args)...)), Pairlist(std::forward<Args>(args)...)))](auto&&...) mutable {
return as<double>(unwindProtect(r_eval, static_cast<void*>(&r_call)));
return [r_eval = [](void* expr) { return Rf_eval(*static_cast<SEXP*>(expr), R_GlobalEnv); }, r_call = RObject(Rf_lcons(Function(Function::operator()(std::forward<Args>(args)...)), Pairlist(std::forward<Args>(args)...)))](auto&&...) {
return as<double>(unwindProtect(r_eval, static_cast<void*>(const_cast<RObject*>(&r_call))));
};
}
};
Expand Down

0 comments on commit c16317a

Please sign in to comment.