Skip to content

Commit

Permalink
fix: give part_index_ a default value (#2020)
Browse files Browse the repository at this point in the history
  • Loading branch information
scarf005 authored Oct 21, 2022
1 parent 1e3682a commit a4bdfa9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/vpart_position.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <functional>
#include <string>
#include <utility>
#include <limits>

#include "optional.h"

Expand Down Expand Up @@ -37,7 +38,8 @@ class vpart_position
{
private:
std::reference_wrapper<::vehicle> vehicle_;
size_t part_index_;
// silence GCC maybe-uninitialized warning by giving it a default value
size_t part_index_ = std::numeric_limits<size_t>::max();

public:
vpart_position( ::vehicle &v, const size_t part ) : vehicle_( v ), part_index_( part ) { }
Expand Down

0 comments on commit a4bdfa9

Please sign in to comment.