diff --git a/src/stan/mcmc/hmc/hamiltonians/diag_e_metric.hpp b/src/stan/mcmc/hmc/hamiltonians/diag_e_metric.hpp index ba895082602..ccc0b8d3346 100644 --- a/src/stan/mcmc/hmc/hamiltonians/diag_e_metric.hpp +++ b/src/stan/mcmc/hmc/hamiltonians/diag_e_metric.hpp @@ -46,7 +46,7 @@ class diag_e_metric : public base_hamiltonian { rand_diag_gaus(rng, boost::normal_distribution<>()); z.p = z.get_inv_metric().unaryExpr( - [&](auto&& x) { return rand_diag_gaus() / sqrt(x); }); + [&rand_diag_gaus](auto&& x) { return rand_diag_gaus() / sqrt(x); }); } };