Skip to content

Commit

Permalink
Merge pull request #882 from jackwasey/abortstrsxp
Browse files Browse the repository at this point in the history
when debugging, abort with error on cast when incompatible with STRSXP
  • Loading branch information
eddelbuettel committed Jul 20, 2018
2 parents 2d4eb21 + 6cf0bf3 commit e0f04a8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions inst/include/Rcpp/r_cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,12 @@ namespace Rcpp {
return Rf_ScalarString( PRINTNAME( x ) );
default:
const char* fmt = "Not compatible with STRSXP: [type=%s].";
#ifndef NDEBUG
REprintf(fmt, Rf_type2char(TYPEOF(x)));
abort();
#else
throw ::Rcpp::not_compatible(fmt, Rf_type2char(TYPEOF(x)));
#endif
}
return R_NilValue; /* -Wall */
}
Expand Down

0 comments on commit e0f04a8

Please sign in to comment.