math: Compilation error
Describe the bug
I got my first situation now where the initial syntax check or so that stan is doing passes, but the compilation fails. And I don’t really understand why or how I can start to debug this - I tried to change the code for an hour and it still fails. I cannot reproduce the compilation error when having the single function in a separate stan file.
To Reproduce
Apologies - I could not reproduce this bug so far in a minimum example. The problem comes down to a block of code like this:
matrix fun(matrix time) {
matrix[rows(time), cols(time)] result;
real val;
val = time[1, 2];
return result;
}
(note that this is simplified but it fails like this) It starts compiling but after few seconds gives a huge error message, that ends with:
stan/src/stan/model/indexing/rvalue.hpp:55:10: note: template argument deduction/substitution failed:
/tmp/RtmpiGD5kC/model-4fe3695a40a9.hpp:436:17: note: candidate expects 2 arguments, 4 provided
436 | val = rvalue(time, "time", index_uni(1), index_uni(2));
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [make/program:58: /tmp/RtmpiGD5kC/model-4fe3695a40a9] Fehler 1
Fehler: An error occured during compilation! See the message above for more information.
Expected behavior
I would have expected that the code compiles without error.
Operating system
Ubuntu 20.04.3 LTS
CmdStanR version number
CmdStan 2.28.2 via cmdstanr_0.4.0
Additional context
Compiler/Toolkit: g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (13 by maintainers)
Commits related to this issue
- fix for #2669 — committed to stan-dev/math by rok-cesnovar 2 years ago
It’s a bug in
to_matrix(), which is also why this was an issue in previous releases and it was not the recently added requires. Moving to Math 😃