In some cases with template instantiation from pyroot together with RDF code which should fail to compile with clear error messages leads instead to cryptic output. Even worse, execution continues and gives undefined results.
Example
import ROOT
ret = ROOT.gInterpreter.Declare('#include "test.h"')
print("declare ret", ret)
print("creating helper")
helper = ROOT.helper[ROOT.std.vector["double"]]()
d = ROOT.ROOT.RDataFrame(1000)
print("Define with helper")
d = d.Define("fx", helper, [])
print("done define")
res = d.Sum("fx")
print(res.GetValue())
template <typename T>
class helper {
public:
helper() {}
std::size_t operator() () {
const double res = 0.;
res = T{0, 0}.size();
return res;
}
};
Note the assignment to const double which should fail to compile.
output (centos stream 8, root 6.26/10)
declare ret True
creating helper
Define with helper
IncrementalExecutor::executeFunction: symbol '_ZN6helperISt6vectorIdSaIdEEEclEv' unresolved while linking symbol '__cf_13'!
You are probably missing the definition of helper<std::vector<double, std::allocator<double> > >::operator()()
Maybe you need to load the corresponding shared library?
done define
9.408421539373414e+16
(if the spurious const is removed then instead one gets the correct output of 2000 and no error message)
In some cases with template instantiation from pyroot together with RDF code which should fail to compile with clear error messages leads instead to cryptic output. Even worse, execution continues and gives undefined results.
Example
Note the assignment to
const doublewhich should fail to compile.output (centos stream 8, root 6.26/10)
(if the spurious const is removed then instead one gets the correct output of 2000 and no error message)