Compile error in bzr8754[trunk] save_handler.cc on OSX

Bug #1782377 reported by Klaus Halfmann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
widelands
Fix Released
Critical
Unassigned

Bug Description

Just tried to compile trunk on OSX and got:

[ 92%] Building CXX object src/logic/CMakeFiles/logic.dir/save_handler.cc.o
.../trunk/src/logic/player.cc:1483:28: error: no viable overloaded operator[] for type 'const
      std::__1::__vector_base<std::__1::vector<unsigned int, std::__1::allocator<unsigned int> >,
      std::__1::allocator<std::__1::vector<unsigned int, std::__1::allocator<unsigned int> > > >::value_type' (aka 'const
      std::__1::vector<unsigned int, std::__1::allocator<unsigned int> >')
                        oss << stats[ware_index][stats[ware_index].rbegin()];
                               ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/vector:645:47: note: candidate
      function not viable: no known conversion from 'std::__1::vector<unsigned int, std::__1::allocator<unsigned int>
      >::const_reverse_iterator' (aka 'reverse_iterator<__wrap_iter<const unsigned int *> >') to 'std::__1::vector<unsigned int,
      std::__1::allocator<unsigned int> >::size_type' (aka 'unsigned long') for 1st argument
    _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const;
                                              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/vector:644:47: note: candidate
      function not viable: 'this' argument has type 'const std::__1::__vector_base<std::__1::vector<unsigned int,
      std::__1::allocator<unsigned int> >, std::__1::allocator<std::__1::vector<unsigned int, std::__1::allocator<unsigned int> > >
      >::value_type' (aka 'const std::__1::vector<unsigned int, std::__1::allocator<unsigned int> >'), but method is not marked const
    _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n);

Travis ist still pending https://travis-ci.org/widelands/widelands/builds/405366221 ?

Not sure if this is a broken automatic merge from bug-1678987-save-handler.

Related branches

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

From: https://code.launchpad.net/~widelands-dev/widelands/bug-1678987-save-handler/+merge/349096

Correct: stats[ware_index][stats[ware_index].size() - 1];

Failure: stats[ware_index][stats[ware_index].rbegin()];

Gun: looks like your fix for the codecheck, was the wrong one?

I will have to medidate what the correct syntax might be.

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

This now has hit the first branch, too:

bug-1703833-catch-missing-datadir
https://travis-ci.org/widelands/widelands/builds/405393952

Reverting that change fixes ther error, trying to find the correct syntax now.

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

trying to fix this now

Changed in widelands:
assignee: nobody → Klaus Halfmann (klaus-halfmann)
Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

Got some fix, will push the branch to lp in a few minutes

Changed in widelands:
status: New → Fix Committed
Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

OK the bug is actually in src/logic/player.cc

Revision history for this message
Klaus Halfmann (klaus-halfmann) wrote :

OK, Fix is ot actually in trunk yet ....

Changed in widelands:
status: Fix Committed → In Progress
Changed in widelands:
assignee: Klaus Halfmann (klaus-halfmann) → nobody
status: In Progress → Fix Committed
Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed in build20-rc1

Changed in widelands:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.