Skip to content

Commit

Permalink
Merge pull request #26 from AntelopeIO/unpack-error
Browse files Browse the repository at this point in the history
static_assert for fc unpack of const type
  • Loading branch information
heifner authored Apr 12, 2024
2 parents f937913 + 330be3b commit ab66679
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions libraries/libfc/include/fc/io/raw.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,7 @@ namespace fc {

template<typename Stream, typename T> inline void unpack( Stream& s, const T& vi )
{
T tmp;
fc::raw::unpack( s, tmp );
FC_ASSERT( vi == tmp );
static_assert(not std::is_same_v<const T, const T>, "can't unpack const type");
}

template<typename Stream> inline void pack( Stream& s, const char* v ) {
Expand Down

0 comments on commit ab66679

Please sign in to comment.