Diagnose doesn't support cpp14 in package development?


#1

Hi, first of all, thank you for providing such a good place to communicate.

Although GUN R 3.4.0 has officially supported cpp14 in package development, the Rstudio IDE doesn’t support cpp14 well (at least in windows).

For example, if I set CXX_STD = cpp14 in Makevars( and Makevars.win), the Rstudio IDE’s diagnose will keep telling me errors on anything related to modern cpp feathers like auto

However, I can still compile…

Any workarounds?


#2

My understanding is that the CXX_STD field should be CXX14 to indicate that C++ source files will adhere to the C++14 standard. This is discussed in more detail at https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Using-C_002b_002b14-code.

Does changing your Makevars line to:

CXX_STD = CXX14

alleviate the issue?


#3

Sorry, it’s just a typo. I do specified CXX_STD = CXX14 in Makevars. I’ve also tried SystemRequirements: C++14 in DESCRIPTION file.

Yes I can confirm it works find on my OSX with latest Rstudio v1.1 but the issue was found on a windows 7 computer.
The version of Rstudio on that computer may be not the very latest. However, I don’t find anything related to cpp in the release notes https://www.rstudio.com/products/rstudio/download/preview-release-notes/.

Anyway I’ll update the Rstudio version on Monday, and let you know if it will solve the issue.

Thanks for your help.


#4

Hi, @kevinushey

Here you can see the diagnose tool breaks down as long as I use CXX14.
However, I can compile the package without a problem.

Any ideas? I doubt it’s related to the fact that Rstudio uses clang to diagnose and it fails to recognize the cpp14 flag.

BTW, my R’s version is 3.4.1 and Rstudio version is 1.1.364. The system platform is windows 7 sp1.

The snapshot

image

My Makevars


#5

Not sure if it’s correlated but I need to mention that I changed the Makeconf file to be able to use CXX14 in packages, because the values in the red circle were all set to empty. I have to add those values by myself, based on the values in CXX11 etc.

image


#6

Thanks for the extra information! It’s also possible that the version of libclang we’re using for diagnostics is simply too old to handle -std=gnu++14. On Windows, we use libclang 3.4, while on other platforms we use libclang 3.5 (for technical reasons).

If the issue is not seen on other platforms, it’s possible this issue might go away when we next try updating the bundled version of libclang.


#7

Glad to hear that. Thanks.