Description of Problem: | cat >test.cc <<"EOF" | #include <map> | | int main() | { | std::map<int,int> a,b; | a = b; | } | EOF | | $ g++ -Wall -fmessage-length=0 trcp.cc | /usr/include/g++-v3/bits/stl_tree.h: In member function `std::_Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc>& std::_Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc>::operator=(const std::_Rb_tree<_Key, _Value, _KeyOfValue, _Compare, _Alloc>&) [with _Key = int, _Value = std::pair<const int, int>, _KeyOfValue = std::_Select1st<std::pair<const int, int> >, _Compare = std::less<int>, _Alloc = std::allocator<std::pair<const int, int> >]': | /usr/include/g++-v3/bits/stl_map.h:143: instantiated from `std::map<_Key, _Tp, _Compare, _Alloc>& std::map<_Key, _Tp, _Compare, _Alloc>::operator=(const std::map<_Key, _Tp, _Compare, _Alloc>&) [with _Key = int, _Tp = int, _Compare = std::less<int>, _Alloc = std::allocator<std::pair<const int, int> >]' | trcp.cc:6: instantiated from here | /usr/include/g++-v3/bits/stl_tree.h:825: warning: value computed is not used This breaks '-Werror' builds on legitim code. Version-Release number of selected component (if applicable): gcc-3.1-0.22
Happens whenever a class without an attribute is copied: --- struct less {}; int main() { less a,b; b = a; } --- In this case, the warning may be right, but when less is used as a template-argument as in stl_tree.h, it can not be foreseen, if a copy operation makes a sense or not.
Should be fixed in gcc-3.1-0.23 and later.