Skip to content

Commit 6414323

Browse files
committed
Safer casting in operator= (closes #146)
1 parent 012d5a9 commit 6414323

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2014-05-18 Kevin Ushey <[email protected]>
2+
3+
* inst/include/Rcpp/vector/Vector.h: Safer casting to fix #146
4+
15
2014-05-10 Dirk Eddelbuettel <[email protected]>
26

37
* R/Attributes.R (compileAttributes): Read Imports: as well

inst/include/Rcpp/vector/Vector.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,9 @@ class Vector :
941941
// anything else
942942
template <typename T>
943943
inline void assign_object( const T& x, traits::false_type ) {
944-
Storage::set__( r_cast<RTYPE>( wrap(x) ) ) ;
944+
Shield<SEXP> wrapped(wrap(x));
945+
Shield<SEXP> casted(r_cast<RTYPE>(wrapped));
946+
Storage::set__(casted);
945947
}
946948

947949
// we are importing a real sugar expression, i.e. not a vector

0 commit comments

Comments
 (0)