Dear All, I am trying to pass to C++ an R list that contains a data frame. Using gcc the following
############################# #include <Rcpp.h> using namespace Rcpp; // [[Rcpp::export]] void withDF(Rcpp::List bl) { Rcpp::DataFrame df1 = bl["the_df"]; Rcpp::Rcout << " rows are " << df1.size() << std::endl; } ################ works fine. Using clang (version 3.8 in a system with Debian, but I think same issues in Mac with clang 4) I get f5.cpp:12:19: error: conversion from 'NameProxy' (aka 'generic_name_proxy<19>') to 'Rcpp::DataFrame' (aka 'DataFrame_Impl<PreserveStorage>') is ambiguous Rcpp::DataFrame df1 = bl["the_df"]; ^ ~~~~~~~~~~~~ /home/ramon/Sources/R-3.5.0-73698/library/Rcpp/include/Rcpp/vector/proxy.h:165:3: note: candidate function [with T = Rcpp::DataFrame_Impl<PreserveStorage>] operator T() const { ^ /home/ramon/Sources/R-3.5.0-73698/library/Rcpp/include/Rcpp/DataFrame.h:51:9: note: candidate constructor [with T = Rcpp::internal::generic_name_proxy<19>] DataFrame_Impl( const T& obj ) ; ^ 1 error generated. /home/ramon/Sources/R-3.5.0-73698/etc/Makeconf:166: recipe for target 'f5.o' failed make: *** [f5.o] Error 1 Error in sourceCpp("f5.cpp", verbose = TRUE, rebuild = TRUE) : Error 1 occurred building shared library. Note that the following, treating the data frame as a list, works fine with both gcc and clang #include <Rcpp.h> using namespace Rcpp; // [[Rcpp::export]] void withList(Rcpp::List bl) { Rcpp::List df1 = bl["the_df"]; Rcpp::Rcout << " size is " << df1.size() << std::endl; Rcpp::IntegerVector c1 = df1["first"]; Rcpp::Rcout << " rows are " << c1.size() << std::endl; } Is this bug? Best, R. -- Ramon Diaz-Uriarte Department of Biochemistry, Lab B-25 Facultad de Medicina Universidad Autónoma de Madrid Arzobispo Morcillo, 4 28029 Madrid Spain Phone: +34-91-497-2412 Email: rdia...@gmail.com ramon.d...@iib.uam.es http://ligarto.org/rdiaz _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel