Skip to content

Commit e0f04a8

Browse files
authored
Merge pull request #882 from jackwasey/abortstrsxp
when debugging, abort with error on cast when incompatible with STRSXP
2 parents 2d4eb21 + 6cf0bf3 commit e0f04a8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

inst/include/Rcpp/r_cast.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,12 @@ namespace Rcpp {
123123
return Rf_ScalarString( PRINTNAME( x ) );
124124
default:
125125
const char* fmt = "Not compatible with STRSXP: [type=%s].";
126+
#ifndef NDEBUG
127+
REprintf(fmt, Rf_type2char(TYPEOF(x)));
128+
abort();
129+
#else
126130
throw ::Rcpp::not_compatible(fmt, Rf_type2char(TYPEOF(x)));
131+
#endif
127132
}
128133
return R_NilValue; /* -Wall */
129134
}

0 commit comments

Comments
 (0)