[R-SIG-Mac] Some exceptions not thrown properly with clang4
Jonah S Gabry
jsg2201 at columbia.edu
Wed Sep 20 20:00:12 CEST 2017
With clang4 installed and Makevars updated as described at
https://cran.r-project.org/bin/macosx/ we are finding unexpected behavior
related to exceptions. The issue was brought to our attention at
http://discourse.mc-stan.org/t/error-in-rstan-2-16-2-after-upgrading-to-r-3-4-1-with-clang-4-0-0/1893
but here is a minimal example:
Put the following in "test.cpp":
#include <Rcpp.h> using namespace Rcpp; // [[Rcpp::export]] int
throw_exception() { std::stringstream errmsg; errmsg << "this is an
exception"; throw std::domain_error(errmsg.str()); return 0; }
Then compile and test it with:
Rcpp::sourceCpp("test.cpp")
throw_exception()
The output is:
Error in throw_exception() : c++ exception (unknown reason)
But the expected output (and the output I get when using e.g. the clang
installation from Xcode) is:
Error in throw_exception() : this is an exception
Is this a known issue?
Thanks,
Jonah
-----
I'm running the following:
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6
[[alternative HTML version deleted]]
More information about the R-SIG-Mac
mailing list