diff --git a/rstan/rstan/R/expose_stan_functions.R b/rstan/rstan/R/expose_stan_functions.R index d423eb2bf..b93420107 100644 --- a/rstan/rstan/R/expose_stan_functions.R +++ b/rstan/rstan/R/expose_stan_functions.R @@ -30,7 +30,7 @@ expose_stan_functions_hacks <- function(code, includes = NULL) { code, sep = "\n") code <- gsub("// [[stan::function]]", "// [[Rcpp::export]]", code, fixed = TRUE) - code <- gsub("stan::math::accumulator& lp_accum__,(\\n)?(\\s*)?std::ostream\\* pstream__ = (nullptr|0))(\\s*)?\\{", + code <- gsub("stan::math::accumulator& lp_accum__,(\\n)?(\\s*)?std::ostream\\*(\\n)?(\\s*)?pstream__(\\n)?(\\s*)?=(\\n)?\\s*)?(nullptr|0))(\\s*)?\\{", "std::ostream* pstream__ = nullptr){\nstan::math::accumulator lp_accum__;", code) code <- gsub("pstream__(\\s*|)=(\\s*|)nullptr", "pstream__ = 0", code)