Demonstrates that a throw Rcpp::internal::InterruptedException()
in compilation unit A cannot be caught by a catch(Rcpp::internal::InterruptedException)
in compilation unit B.
Repro:
- Run
exceptiontest::throwAndCatchInterrupt()
, note that it printsInterrupted
(the desired behavior). - Run the following code (will create a separate compilation unit):
library(exceptiontest)
Rcpp::cppFunction('
void throwAndCatchInterrupt2() {
typedef void (*tifunc)();
tifunc func = (tifunc)R_GetCCallable("exceptiontest", "throwInterrupt");
try {
func();
} catch (Rcpp::internal::InterruptedException) {
fprintf(stderr, "Interrupted\\n");
} catch (...) {
fprintf(stderr, "Unknown error\\n");
}
}
')
- Run the newly compiled
throwAndCatchInterrupt2()
, note that it printsUnknown error
.