diff --git a/inst/include/cpp11/declarations.hpp b/inst/include/cpp11/declarations.hpp index ed57721f..89f24a65 100644 --- a/inst/include/cpp11/declarations.hpp +++ b/inst/include/cpp11/declarations.hpp @@ -41,7 +41,7 @@ T& unmove(T&& t) { SEXP err = R_NilValue; \ char buf[CPP11_ERROR_BUFSIZE] = ""; \ try { -#define END_CPP11 \ +#define END_CPP11_EX(RET) \ } \ catch (cpp11::unwind_exception & e) { \ err = e.token; \ @@ -57,4 +57,5 @@ T& unmove(T&& t) { } else if (err != R_NilValue) { \ R_ContinueUnwind(err); \ } \ - return R_NilValue; + return RET; +#define END_CPP11 END_CPP11_EX(R_NilValue)