Skip to content

Commit

Permalink
Merge commit '2a2973183824e1ab35efd8f536491cdd7bd316ed' into develop
Browse files Browse the repository at this point in the history
* commit '2a2973183824e1ab35efd8f536491cdd7bd316ed':
  Fix -Wsign-compare warnings in variant.hpp; also catches the case when `which` is negative
  • Loading branch information
robertramey committed Jun 8, 2024
2 parents d8e072a + 2a29731 commit 38a3cd5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/boost/serialization/variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void load(
int which;
typedef typename boost::variant<Types...>::types types;
ar >> BOOST_SERIALIZATION_NVP(which);
if(which >= sizeof...(Types)){
if(static_cast<std::size_t>(which) >= sizeof...(Types)){
// this might happen if a type was removed from the list of variant types
boost::serialization::throw_exception(
boost::archive::archive_exception(
Expand All @@ -238,7 +238,7 @@ void load(
int which;
typedef typename boost::variant<Types...>::types types;
ar >> BOOST_SERIALIZATION_NVP(which);
if(which >= sizeof...(Types)){
if(static_cast<std::size_t>(which) >= sizeof...(Types)){
// this might happen if a type was removed from the list of variant types
boost::serialization::throw_exception(
boost::archive::archive_exception(
Expand Down

0 comments on commit 38a3cd5

Please sign in to comment.