Skip to content

NoProtectStorage compile error #849

@romainfrancois

Description

@romainfrancois

NoProtectStorage was meant to be used in cases when you don't want to pay for preserve and release because the object is already protected:

> Rcpp::cppFunction( 'void f(){ Rcpp::Vector<STRSXP, NoProtectStorage> s(1); s[0] = "" ; }' )
In file included from file1c206f8abb9c.cpp:1:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include/Rcpp.h:40:
In file included from /Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include/Rcpp/Vector.h:54:
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include/Rcpp/vector/traits.h:73:41: error: no matching constructor for initialization of 'Rcpp::traits::proxy_cache<16, NoProtectStorage>::proxy' (aka 'string_proxy<16>')
                inline proxy ref(R_xlen_t i) { return proxy(*p,i);}
                                                      ^     ~~~~
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include/Rcpp/vector/Vector.h:339:57: note: in instantiation of member function 'Rcpp::traits::proxy_cache<16, NoProtectStorage>::ref' requested here
    inline Proxy operator[]( R_xlen_t i ){ return cache.ref(i) ; }
                                                        ^
file1c206f8abb9c.cpp:6:57: note: in instantiation of member function 'Rcpp::Vector<16, NoProtectStorage>::operator[]' requested here
void f(){ Rcpp::Vector<STRSXP, NoProtectStorage> s(1); s[0] = "" ; }
                                                        ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include/Rcpp/vector/string_proxy.h:43:3: note: candidate constructor not viable: no known conversion from 'Rcpp::traits::proxy_cache<16, NoProtectStorage>::VECTOR' (aka 'Vector<16, NoProtectStorage>') to 'Rcpp::internal::string_proxy<16>::VECTOR &' (aka 'Vector<16> &') for 1st argument
                string_proxy( VECTOR& v, R_xlen_t index_ ) : parent(&v), index(index_){}
                ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include/Rcpp/vector/string_proxy.h:45:3: note: candidate constructor not viable: requires single argument 'other', but 2 arguments were provided
                string_proxy( const string_proxy& other ) :
                ^
/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include/Rcpp/vector/string_proxy.h:35:3: note: candidate constructor not viable: requires 0 arguments, but 2 were provided
                string_proxy() : parent(0), index(-1){};
                ^
1 error generated.
make: *** [file1c206f8abb9c.o] Error 1
clang++  -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I"/private/var/folders/r_/1b2gjtsd7j92jbbpz4t7ps340000gn/T/Rtmp4GFH1U/sourceCpp-x86_64-apple-darwin15.6.0-0.12.16" -I/usr/local/include   -fPIC  -Wno-unused-result -Wno-c++11-inline-namespace -O3 -c file1c206f8abb9c.cpp -o file1c206f8abb9c.o
Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir,  : 
  Error 1 occurred building shared library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions