-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stan code parsers successfully but fails to compile due to pstream__ not declared error #530
Comments
This seems to be caused by the fact that you can't use a function to set vector size. Is this a "deliberate" design choice or a bug? I was trying to use constants to set the size of my arrays instead of hard coded values (sirFunctions.stan is auto generated). The manual says the way to define constants in stan is:
So I assumed this would mean you could use such constants when defining vector/array size. |
Thanks for reporting. Models shouldn't translate to C++ and then not compile, so that's a bug. As far as the language design, the intention is that a function may be used to determine a size for a block variable or local variable as long as the function is constant---it can't change values based on parameters. The situation that's failing here is using it to define a local variable in a function:
The problem is that it's not getting a print stream passed in.
We'll fix this. |
Thanks! Just as a follow-up. This does work as expected in the |
Here's a smaller example of both where I get the same failure to compile:
|
Still an issue in stanc3. Transferring. |
Summary:
I tried to compile a stan model, which was successfully parsed, but fails to compile due to:
./sirStrain.hpp:2822:40: error: ‘pstream__’ was not declared in this scope
. Compilation was attempted both with rstan and cmdstanDescription:
See Summary
Reproducible Steps:
Try to compile with cmdStan (2.18.0):
Note that the actual stan code is included below.
Current Output:
Expected Output:
A working model
Additional Information:
I tested this both from R (rstan) and cmdStan. In R it failed, but did not provide helpful information. Included here is the cmdStan output.
Current Version:
v2.18.0
The model consists of two files. The main file: sirStrain.stan
and the included file sirFunctions.stan:
EDIT: clarify text
The text was updated successfully, but these errors were encountered: