-
-
Notifications
You must be signed in to change notification settings - Fork 51
Closed
Labels
Description
As encountered in trying to work around #1534
The following (complete minimal reproducer) Stan file does not compile (from CmdStanR 2.36.0 ):
functions {
void do_something_reconstruct(data array[] int indices, data vector mem){
do_something((indices, mem));
}
void do_something(data tuple(array[] int, vector) combined){
}
}It of course also does not compile if it's part of a "proper" Stan file and the function actually gets called.
It does compile if mem is instead e.g. a data array[] int.
I don't know whether this issue is specific to CmdStanR, but I wouldn't suspect so.
Compile error:
/tmp/Rtmp17MqPt/model-cbef674f22ed.hpp: In function ‘void tuples_model_namespace::do_something_reconstruct(const std::vector<int>&, const T1__&, std::ostream*)’:
/tmp/Rtmp17MqPt/model-cbef674f22ed.hpp:44:17: error: no matching function for call to ‘do_something(std::tuple<const std::vector<int, std::allocator<int> >&, Eigen::Matrix<double, -1, 1, 0, -1, 1> >, std::ostream*&)’
44 | do_something(
| ~~~~~~~~~~~~^
45 | std::tuple<const std::vector<int>&, Eigen::Matrix<double,-1,1>>(indices,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46 | mem), pstream__);
| ~~~~~~~~~~~~~~~~
/tmp/Rtmp17MqPt/model-cbef674f22ed.hpp:22:1: note: candidate: ‘template<class T0__1__, stan::require_all_t<stan::is_col_vector<T>, stan::is_vt_not_complex<T1__> >* <anonymous> > void tuples_model_namespace::do_something(const std::tuple<std::vector<int, std::allocator<int> >, T0__1__>&, std::ostream*)’
22 | do_something(const std::tuple<std::vector<int>, T0__1__>& combined,
| ^~~~~~~~~~~~
/tmp/Rtmp17MqPt/model-cbef674f22ed.hpp:22:1: note: template argument deduction/substitution failed:
/tmp/Rtmp17MqPt/model-cbef674f22ed.hpp:44:17: note: mismatched types ‘std::vector<int>’ and ‘const std::vector<int>&’
44 | do_something(
| ~~~~~~~~~~~~^
45 | std::tuple<const std::vector<int>&, Eigen::Matrix<double,-1,1>>(indices,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46 | mem), pstream__);
| ~~~~~~~~~~~~~~~~
Reactions are currently unavailable