<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">I’m currently working on a header-only library that it intended to act as a “glue" layer between an existing C++11 library (also header only) and R, by means of Rcpp.</div><div class=""><br class=""></div><div class="">Basically, I am trying to provide some generic templates that perform operations using the existing C++11 library and return appropriate data objects to the R environment.</div><div class=""><br class=""></div><div class="">My current plan for this library is that:</div><div class=""><br class=""></div><div class="">1. It is also c++11</div><div class="">2. It exists in its own namespace</div><div class=""><br class=""></div><div class="">Rcpp seems to have problems with the latter, but only on GCC.  I am unable to return XPtr to objects whose names are typedefs within a namespace.  However, everything works using clang++.</div><div class=""><br class=""></div><div class="">A reproducible example of this issue can be found at <a href="https://gist.github.com/molpopgen/989ec678664d083bf4a3" class="">https://gist.github.com/molpopgen/989ec678664d083bf4a3</a></div><div class=""><br class=""></div><div class="">Version numbers are:</div><div class="">Rcpp - 0.11.6</div><div class="">R - 3.1.0</div><div class="">g++ - 4.9.2</div><div class="">clang++ — 3.5 and 3.6</div><div class="">Ubuntu 14.04 LTS</div><div class=""><br class=""></div><div class="">I first discovered this when code I’d implemented on OS X/Yosemite/clang failed to link on my Linux box, where g++ is the default.</div><div class=""><br class=""></div><div class="">If you have git on your system and g++ as your default CXX, then</div><div class=""><br class=""></div><div class="">git clone <a href="https://gist.github.com/molpopgen/989ec678664d083bf4a3" class="">https://gist.github.com/molpopgen/989ec678664d083bf4a3</a></div><div class="">cd 989ec678664d083bf4a3</div><div class="">##This fails on my system with GCC w/no deleter for the XPtr found, but it compiles fine if I set ~/.R/Makevars to say CXX=clang++-3.6</div><div class="">Rscript doit.R</div><div class="">##This works with any of the compilers on my Ubunutu system, because I provide a custom deleter for the XPtr</div><div class="">Rscript doit2.R</div><div class=""><br class=""></div><div class="">If you look at the comments in the C++ code in the gist, this issue arises due to a strange mix of typedefs in a namespace + a template function in the same namespace.  However, I don’t think that this is an unusual use case.  Looking at the XPtr implementation, I don’t see any reason for the symbol not to be generated.</div><div class=""><br class=""></div><div class="">Thanks,</div><div class=""><br class=""></div><div class="">Kevin</div></body></html>