Bug 61047 - Warning in standard-library
Warning in standard-library
Status: CLOSED CURRENTRELEASE
Product: Red Hat Raw Hide
Classification: Retired
Component: gcc (Show other bugs)
1.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-03-12 12:24 EST by Enrico Scholz
Modified: 2007-04-18 12:40 EDT (History)
0 users

See Also:
Fixed In Version: 3.2.2-5
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-08-05 12:03:32 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Enrico Scholz 2002-03-12 12:24:28 EST
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
Comment 1 Enrico Scholz 2002-03-13 08:12:12 EST
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.
Comment 2 Jakub Jelinek 2003-08-05 12:03:32 EDT
Should be fixed in gcc-3.1-0.23 and later.

Note You need to log in before you can comment on or make changes to this bug.