no match for 'operator=' in 'stale_it = (& stale_set)->std::

Questions, problems and discussion about compiling FreeOrion.

Moderator: Oberlus

Post Reply
Message
Author
User avatar
Nagilum
Release Manager, Design
Posts: 212
Joined: Thu Dec 31, 2009 3:25 pm
Location: Germany

no match for 'operator=' in 'stale_it = (& stale_set)->std::

#1 Post by Nagilum »

Looks like commit https://github.com/freeorion/freeorion/ ... 68f5972e5a broke the build with gcc:
55
Rev 5547:
[ 0%] Building CXX object CMakeFiles/core_static.dir/universe/Universe.cpp.o
/root/freeorion/src/freeorion-build/universe/Universe.cpp: In function 'void {anonymous}::PropegateVisibilityToContainerObjects(const ObjectMap&, Universe::EmpireObjectVisibilityMap&)':
/root/freeorion/src/freeorion-build/universe/Universe.cpp:1759:19: warning: unused variable 'universe' [-Wunused-variable]
/root/freeorion/src/freeorion-build/universe/Universe.cpp: In member function 'void Universe::UpdateEmpireStaleObjectKnowledge()':
/root/freeorion/src/freeorion-build/universe/Universe.cpp:2152:52: error: no match for 'operator=' in 'stale_it = (& stale_set)->std::set<_Key, _Compare, _Alloc>::erase<int, std::less<int>, std::allocator<int> >(stale_it)'
/root/freeorion/src/freeorion-build/universe/Universe.cpp:2152:52: note: candidate is:
In file included from /usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/map:60:0,
from /usr/include/GG/Enum.h:35,
from /root/freeorion/src/freeorion-build/universe/Enums.h:5,
from /root/freeorion/src/freeorion-build/universe/Universe.h:5,
from /root/freeorion/src/freeorion-build/universe/Universe.cpp:1:
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/stl_tree.h:227:12: note: std::_Rb_tree_const_iterator<int>& std::_Rb_tree_const_iterator<int>::operator=(const std::_Rb_tree_const_iterator<int>&)
/usr/lib/gcc/i686-pc-linux-gnu/4.7.2/../../../../include/c++/4.7.2/bits/stl_tree.h:227:12: note: no known conversion for argument 1 from 'void' to 'const std::_Rb_tree_const_iterator<int>&'
/root/freeorion/src/freeorion-build/universe/Universe.cpp: At global scope:
/root/freeorion/src/freeorion-build/universe/Universe.cpp:47:10: warning: '{anonymous}::temp_bool' defined but not used [-Wunused-variable]
make[2]: *** [CMakeFiles/core_static.dir/universe/Universe.cpp.o] Error 1
make[1]: *** [CMakeFiles/core_static.dir/all] Error 2
make: *** [all] Error 2

User avatar
Nagilum
Release Manager, Design
Posts: 212
Joined: Thu Dec 31, 2009 3:25 pm
Location: Germany

Re: no match for 'operator=' in 'stale_it = (& stale_set)->s

#2 Post by Nagilum »

Changing this line fixes the build:

2152 stale_it = stale_set.erase(stale_it);
to
2152 stale_set.erase(stale_it);

but I have no idea if I break the logic. :-/

User avatar
Nagilum
Release Manager, Design
Posts: 212
Joined: Thu Dec 31, 2009 3:25 pm
Location: Germany

Re: no match for 'operator=' in 'stale_it = (& stale_set)->s

#3 Post by Nagilum »

Ok, doesn't seem to work that way. I guess I'll have to wait for someone who knows what he's doing. .-)

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 12725
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: no match for 'operator=' in 'stale_it = (& stale_set)->s

#4 Post by Geoff the Medio »

Apparently there was no overload of set::erase that returned an iterator in the standard until C++11 but MSVC 2010 has one anyway... Will attempt to fix.

User avatar
Nagilum
Release Manager, Design
Posts: 212
Joined: Thu Dec 31, 2009 3:25 pm
Location: Germany

Re: no match for 'operator=' in 'stale_it = (& stale_set)->s

#5 Post by Nagilum »

Thanks!
I just build r5553 without issues.

User avatar
Vezzra
Release Manager, Design
Posts: 5408
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: no match for 'operator=' in 'stale_it = (& stale_set)->s

#6 Post by Vezzra »

Compile on OSX works too.

Post Reply