Skip to content

Commit

Permalink
rstan: pass error output to stanc translator
Browse files Browse the repository at this point in the history
  • Loading branch information
maverickg committed Oct 25, 2012
1 parent 60ab347 commit 816f100
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
21 changes: 21 additions & 0 deletions rstan/example/testintdiv.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# test warning for integer division

library(rstan)


scode <- '
transformed data {
int x;
x <- 5 / 2;
}
parameters {
real y;
}
model {
y ~ normal(x, 1);
}
'


a <- stan(model_code = scode, iter = 10)

3 changes: 2 additions & 1 deletion rstan/rstan/src/stanc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <string>

#include <Rcpp.h>
#include <rstan/io/r_ostream.hpp>

RcppExport SEXP stanc(SEXP model_stancode, SEXP model_name);
RcppExport SEXP stan_version();
Expand Down Expand Up @@ -45,7 +46,7 @@ SEXP stanc(SEXP model_stancode, SEXP model_name) {
std::istringstream in(mcode_);
try {
bool valid_model
= stan::gm::compile(in,out,mname_,!INCLUDE_MAIN);
= stan::gm::compile(&rstan::io::rcerr,in,out,mname_,!INCLUDE_MAIN);
if (!valid_model) {
return Rcpp::List::create(Rcpp::Named("status") = PARSE_FAIL_RC);

Expand Down

0 comments on commit 816f100

Please sign in to comment.