Hi Rstudio Community,
I'm running Rstudio 1.2.1327 on Windows 10. When editing C++ files, the C++ diagnostics are either absent or incorrect.
For example, when editing the following Rcpp file:
#include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
NumericVector timesTwo(NumericVector x) {
int n = x.size();
return x * 2;
}
The diagnostics suggest that int n = x.size(); will cause an error because
"member reference base type 'Rcpp::NumericVector' (aka 'int') is not a structure or union."
In other contexts, e.g. when editing Rcpp files in a package, no diagnostics appear at all.
The Rstudio log file contains lines like:
18 Mar 2019 13:56:25 [rsession-Josh] ERROR Error parsing translation unit C:/Users/Josh/Documents/mypackage/src/my_rcpp_script.cpp; LOGGED FROM: class rstudio::core::libclang::TranslationUnit __cdecl rstudio::core::libclang::SourceIndex::getTranslationUnit(const class std::basic_string<char,struct std::char_traits,class std::allocator > &,bool) c:\jenkins\workspace\ide\windows\src\cpp\core\libclang\sourceindex.cpp:270
Other relevant info:
> devtools::session_info()
- Session info ------------------------------------------------------------------------------------
setting value
version R version 3.5.1 (2018-07-02)
os Windows 10 x64
system x86_64, mingw32
ui RStudio
language (EN)
collate English_United States.1252
ctype English_United States.1252
tz America/New_York
date 2019-03-18
- Packages ----------------------------------------------------------------------------------------
package * version date lib source
assertthat 0.2.0 2017-04-11 [1] CRAN (R 3.5.1)
backports 1.1.3 2018-12-14 [1] CRAN (R 3.5.2)
base64enc 0.1-3 2015-07-28 [1] CRAN (R 3.5.0)
callr 3.0.0 2018-08-24 [1] CRAN (R 3.5.1)
cli 1.0.1 2018-09-25 [1] CRAN (R 3.5.1)
crayon 1.3.4 2017-09-16 [1] CRAN (R 3.5.1)
desc 1.2.0 2018-05-01 [1] CRAN (R 3.5.1)
devtools 2.0.1 2018-10-26 [1] CRAN (R 3.5.2)
digest 0.6.18 2018-10-10 [1] CRAN (R 3.5.1)
fs 1.2.6 2018-08-23 [1] CRAN (R 3.5.1)
glue 1.3.0 2018-07-17 [1] CRAN (R 3.5.1)
magrittr 1.5 2014-11-22 [1] CRAN (R 3.5.1)
memoise 1.1.0 2017-04-21 [1] CRAN (R 3.5.1)
pkgbuild 1.0.2 2018-10-16 [1] CRAN (R 3.5.1)
pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.5.1)
prettyunits 1.0.2 2015-07-13 [1] CRAN (R 3.5.1)
processx 3.2.0 2018-08-16 [1] CRAN (R 3.5.1)
ps 1.2.1 2018-11-06 [1] CRAN (R 3.5.1)
R6 2.3.0 2018-10-04 [1] CRAN (R 3.5.1)
Rcpp 1.0.0 2018-11-07 [1] CRAN (R 3.5.2)
remotes 2.0.2 2018-10-30 [1] CRAN (R 3.5.1)
rlang 0.3.0.1 2018-10-25 [1] CRAN (R 3.5.1)
rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.5.1)
rstudioapi 0.8 2018-10-02 [1] CRAN (R 3.5.1)
sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.5.1)
usethis 1.4.0 2018-08-14 [1] CRAN (R 3.5.1)
withr 2.1.2 2018-03-15 [1] CRAN (R 3.5.1)
Would greatly appreciate any guidance here,
Josh