Skip to content

Commit 38a3cd5

Browse files
committed
Merge commit '2a2973183824e1ab35efd8f536491cdd7bd316ed' into develop
* commit '2a2973183824e1ab35efd8f536491cdd7bd316ed': Fix -Wsign-compare warnings in variant.hpp; also catches the case when `which` is negative
2 parents d8e072a + 2a29731 commit 38a3cd5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/boost/serialization/variant.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ void load(
216216
int which;
217217
typedef typename boost::variant<Types...>::types types;
218218
ar >> BOOST_SERIALIZATION_NVP(which);
219-
if(which >= sizeof...(Types)){
219+
if(static_cast<std::size_t>(which) >= sizeof...(Types)){
220220
// this might happen if a type was removed from the list of variant types
221221
boost::serialization::throw_exception(
222222
boost::archive::archive_exception(
@@ -238,7 +238,7 @@ void load(
238238
int which;
239239
typedef typename boost::variant<Types...>::types types;
240240
ar >> BOOST_SERIALIZATION_NVP(which);
241-
if(which >= sizeof...(Types)){
241+
if(static_cast<std::size_t>(which) >= sizeof...(Types)){
242242
// this might happen if a type was removed from the list of variant types
243243
boost::serialization::throw_exception(
244244
boost::archive::archive_exception(

0 commit comments

Comments
 (0)