summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
8198fb8)
Functions where looked up by their function name in archives. However,
some functions have overloads for different numbers of parameters
('zeta', 'G', 'psi'). Reading archives could pick the wrong overload.
Fixed by requiring that the actual number of function parameters in the
archive node must equal the function's declared number of parameters.
Thanks to Feng Feng for reporting this problem.
void function::read_archive(const archive_node& n, lst& sym_lst)
{
inherited::read_archive(n, sym_lst);
void function::read_archive(const archive_node& n, lst& sym_lst)
{
inherited::read_archive(n, sym_lst);
- // Find serial number by function name
+ // Find serial number by function name and number of parameters
+ unsigned np = seq.size();
std::string s;
if (n.find_string("name", s)) {
unsigned int ser = 0;
for (auto & it : registered_functions()) {
std::string s;
if (n.find_string("name", s)) {
unsigned int ser = 0;
for (auto & it : registered_functions()) {
+ if (s == it.name && np == registered_functions()[ser].nparams) {
serial = ser;
return;
}
++ser;
}
serial = ser;
return;
}
++ser;
}
- throw (std::runtime_error("unknown function '" + s + "' in archive"));
+ throw (std::runtime_error("unknown function '" + s +
+ "' with " + std::to_string(np) + " parameters in archive"));
} else
throw (std::runtime_error("unnamed function in archive"));
}
} else
throw (std::runtime_error("unnamed function in archive"));
}