Bug 61047 - Warning in standard-library
Summary: Warning in standard-library
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: gcc   
(Show other bugs)
Version: 1.0
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2002-03-12 17:24 UTC by Enrico Scholz
Modified: 2007-04-18 16:40 UTC (History)
0 users

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

Attachments (Terms of Use)

Description Enrico Scholz 2002-03-12 17:24:28 UTC
Description of Problem:

| cat >test.cc <<"EOF"
| #include <map>
| int main()
| {
|         std::map<int,int>       a,b;
|         a = b;
| }
| $ 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):


Comment 1 Enrico Scholz 2002-03-13 13:12:12 UTC
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 16:03:32 UTC
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.