Skip to content

Commit

Permalink
Merge pull request #3294 from stan-dev/fix/model-header-include-order
Browse files Browse the repository at this point in the history
Fix model_header include order when STAN_MODEL_FVAR_VAR is defined
  • Loading branch information
WardBrian authored Jul 10, 2024
2 parents 3c95657 + 343eebb commit 7e76f26
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/stan/model/model_base.hpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef STAN_MODEL_MODEL_BASE_HPP
#define STAN_MODEL_MODEL_BASE_HPP

#include <stan/io/var_context.hpp>
#include <stan/math/rev/core.hpp>
#ifdef STAN_MODEL_FVAR_VAR
#include <stan/math/mix.hpp>
#endif
#include <stan/io/var_context.hpp>
#include <stan/math/rev/core.hpp>
#include <stan/model/prob_grad.hpp>
#include <stan/services/util/create_rng.hpp>
#include <ostream>
Expand Down
2 changes: 1 addition & 1 deletion src/stan/model/model_base_crtp.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#ifndef STAN_MODEL_MODEL_BASE_CRTP_HPP
#define STAN_MODEL_MODEL_BASE_CRTP_HPP

#include <stan/model/model_base.hpp>
#ifdef STAN_MODEL_FVAR_VAR
#include <stan/math/mix.hpp>
#endif
#include <stan/model/model_base.hpp>
#include <iostream>
#include <utility>
#include <vector>
Expand Down
4 changes: 2 additions & 2 deletions src/stan/model/model_header.hpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#ifndef STAN_MODEL_MODEL_HEADER_HPP
#define STAN_MODEL_MODEL_HEADER_HPP

#include <stan/model/model_base.hpp>
#include <stan/model/model_base_crtp.hpp>
#include <stan/math.hpp>

#include <stan/io/deserializer.hpp>
#include <stan/io/serializer.hpp>

#include <stan/model/rethrow_located.hpp>
#include <stan/model/model_base.hpp>
#include <stan/model/model_base_crtp.hpp>
#include <stan/model/prob_grad.hpp>
#include <stan/model/indexing.hpp>
#include <stan/services/util/create_rng.hpp>
Expand Down
9 changes: 9 additions & 0 deletions src/test/test-models/good/model/accumulate.stan
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
data {
int<lower=1> N;
}
parameters {
vector[N] y;
}
model {
target += y;
}
2 changes: 2 additions & 0 deletions src/test/unit/model/compile_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// test model which previously failed with -DSTAN_MODEL_FVAR_VAR
#include <test/test-models/good/model/accumulate.hpp>

0 comments on commit 7e76f26

Please sign in to comment.