You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Invoking the move constructor of external_pointer<> clears attributes on an external pointer object.
I would expect the third and fourth output to be identical to the second output. A possible fix is duckdb/duckdb@12f6f10 (this project uses a vendored version of cpp11).
library(cpp11)
cpp_source(
code=' #include "cpp11/external_pointer.hpp" #include "cpp11/strings.hpp" template <class X> cpp11::external_pointer<int> test_int() { X a = 0; auto p = cpp11::external_pointer<X>(&a, false); Rf_PrintValue(p); Rf_setAttrib(p, R_ClassSymbol, cpp11::writable::strings({"foo"})); Rf_PrintValue(p); return std::move(p); } [[cpp11::register]] SEXP test() { auto p = cpp11::sexp(test_int<int>()); Rf_PrintValue(p); return p; }'
)
out<- test()
#> <pointer: 0x16f0af42c>#> <pointer: 0x16f0af42c>#> attr(,"class")#> [1] "foo"#> <pointer: 0x16f0af42c>out#> <pointer: 0x16f0af42c>
It could be because external_pointer::r_deleter is called on the old_data (in external_pointer::reset) regardless of whether it should be called or not (I would have thought that r_deleter calls were managed by R when it finalised an EXTPTRSXP).
Invoking the move constructor of
external_pointer<>
clears attributes on an external pointer object.I would expect the third and fourth output to be identical to the second output. A possible fix is duckdb/duckdb@12f6f10 (this project uses a vendored version of cpp11).
Created on 2023-03-02 with reprex v2.0.2
The text was updated successfully, but these errors were encountered: