Skip to content

Commit

Permalink
static_assert for unpack of const type instead of generating a FC_ASS…
Browse files Browse the repository at this point in the history
…ERT at runtime.
  • Loading branch information
heifner committed Apr 12, 2024
1 parent f937913 commit 330be3b
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 330be3b

Please sign in to comment.