-
-
Notifications
You must be signed in to change notification settings - Fork 219
Closed
Description
Ie:
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
NumericVector test() {
NumericVector m(1);
m = 1;
return m;
}
/*** R
gctorture(TRUE)
test()
gctorture(FALSE)
*/
produces the exception:
Error in test() : unimplemented type 'double' in 'coerceToReal'
I very strongly suspect this is the same error reported a long time back in http://lists.r-forge.r-project.org/pipermail/rcpp-devel/2011-June/002545.html.
Definitely, this code is an example of something you shouldn't do, but Rcpp
tries to be helpful and make it work anyway.
I imagine the bug is due to the code here, in vector/Vector.h
:
// anything else
template <typename T>
inline void assign_object( const T& x, traits::false_type ) {
Storage::set__( r_cast<RTYPE>( wrap(x) ) ) ;
Because the wrap(x)
-ed object is not protected, it gets cleaned up before r_cast
does its work.
Metadata
Metadata
Assignees
Labels
No labels