Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abort on R type error if debugging #860

Merged
merged 4 commits into from Jun 8, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions ChangeLog
@@ -1,3 +1,6 @@
2018-06-05 Jack Wasey <jack@jackwasey.com>
* inst/include/Rcpp/r_cast.h: Error and abort if debugging

2018-05-09 Dirk Eddelbuettel <edd@debian.org>

* DESCRIPTION: Release 0.12.17
Expand Down
7 changes: 7 additions & 0 deletions inst/include/Rcpp/r_cast.h
Expand Up @@ -67,9 +67,16 @@ namespace Rcpp {
default:
const char* fmt = "Not compatible with requested type: "
"[type=%s; target=%s].";
#ifndef NDEBUG
REprintf(fmt,
Rf_type2char(TYPEOF(x)),
Rf_type2char(RTYPE));
abort();
#else
throw ::Rcpp::not_compatible(fmt,
Rf_type2char(TYPEOF(x)),
Rf_type2char(RTYPE));
#endif
} // #nocov end
return R_NilValue; /* -Wall */
}
Expand Down