-
-
Notifications
You must be signed in to change notification settings - Fork 219
Closed
Description
Defining the following function:
Rcpp::sourceCpp(code = '//[[Rcpp::export]]
void foo(const char* a = "(", const char* b= ")") {}')
gives:
file8586f8153c2.cpp: In function ‘SEXPREC* sourceCpp_63_foo(SEXP)’:
file8586f8153c2.cpp:12:10: error: call of overloaded ‘foo(Rcpp::traits::input_parameter<const char*>::type&)’ is ambiguous
12 | foo(a);
| ^
file8586f8153c2.cpp:2:6: note: candidate: ‘void foo(const char*, const char*)’
2 | void foo(const char* a = "(", const char* b= ")") {}
| ^~~
file8586f8153c2.cpp:7:6: note: candidate: ‘void foo(const char*)’
7 | void foo(const char* a);
| ^~~
make: *** [/usr/lib64/R/etc/Makeconf:176: file8586f8153c2.o] Error 1
g++ -std=gnu++11 -I"/usr/include/R/" -DNDEBUG -I"/home/pr228844/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -I"/tmp/RtmpTogNDM/sourceCpp-x86_64-pc-linux-gnu-1.0.1" -D_FORTIFY_SOURCE=2 -fpic -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -c file8586f8153c2.cpp -o file8586f8153c2.o
Error in Rcpp::sourceCpp(code = "//[[Rcpp::export]]\nvoid foo(const char* a = \"(\", const char* b= \")\") {}") :
Error 1 occurred building shared library.
Inverting the default values, leads to the same error:
Rcpp::sourceCpp(code = '//[[Rcpp::export]]
void foo(const char* a = ")", const char* b= "(") {}')
Replacing one of the default values with another value, remove the error:
Rcpp::sourceCpp(code = '//[[Rcpp::export]]
void foo(const char* a = "x", const char* b= "(") {}')
Metadata
Metadata
Assignees
Labels
No labels