I am using 'Cmdstan ‘2.30.1’ (cmdstanr version ‘0.5.2’) as backend with brms (version ‘2.17.3’). During compilation, following warnings are shown but model compiles successfully and samples as expected.
&, const double&>::recursive_reducer::args_tuple_' [-Wreorder]
std::tuple<Args...> args_tuple_;
^~~~~~~~~~~
stan/lib/stan_math/stan/math/rev/functor/reduce_sum.hpp:78:5: warning: when initialized here [-Wreorder]
recursive_reducer(recursive_reducer& other, tbb::split)
^~~~~~~~~~~~~~~~~
I guess these warnings are harmless but still I want to resolve the issue. I would really appreciate your help.
I understand the concern, but can assure you this warning is harmless.
The reorder warnings (i.e., -Wreorder) occur when the declaration of member variables is in a different order than their initialization. The reason it’s a warning is that the calls are executed in order or declaration, not in the order they’re written in a C++ constructor.
const size_t num_vars_per_term_;
const size_t num_vars_shared_terms_; // Number of vars in shared arguments
double* sliced_partials_; // Points to adjoints of the partial calculations
Vec vmapped_;
std::stringstream msgs_;
std::tuple<Args...> args_tuple_;
scoped_args_tuple local_args_tuple_scope_;
double sum_{0.0};
Eigen::VectorXd args_adjoints_{0};
but the constructor throwing the error initializes this way:
The last two are out of order—args_tuple_ should’ve come before local_args_tuple_scope_. Given there’s no dependent computation, this won’t cause a problem.
I opened an issue in Stan math to rearrange the initializers, which will not change behavior, but will get rid of the warning: