-
-
Notifications
You must be signed in to change notification settings - Fork 219
Closed
Description
If I declare a function taking a scalar and call it with a vector, R dies. Ideally Rcpp would check the length of the input and throw.
I understand this is likely a non-trivial fix. Nevertheless...
Rcpp::sourceCpp(code='
#include <Rcpp.h>
// [[Rcpp::export]]
std::string ex(std::string x) {
std::string y = x;
return(y);
}
')
ex("foo") ## it works if I pass it a scalar
# [1] "foo"
ex(c("foo", "bar")) ## but explodes on a vector
# *** Error in `/usr/lib/R/bin/exec/R': free(): invalid pointer: 0x0000000002d15418 ***
# Aborted
Metadata
Metadata
Assignees
Labels
No labels