Bug 70946

Summary: warnings in standard headers when using -Wshadow
Product: [Retired] Red Hat Linux Reporter: Wagner T. Correa <wtcorrea>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED CURRENTRELEASE QA Contact: Brian Brock <bbrock>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-10-03 00:29:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Wagner T. Correa 2002-08-07 07:40:54 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.0) Gecko/20020529

Description of problem:
When I use the -Wshadow option, some standard header files produce warnings.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. compile the file below

#include <math.h>
#include <string>
#include <hash_map>


Actual Results:  [wtcorrea@neon17 wtcorrea]$ g++ -Wall -Wshadow -c x.cpp 
In file included from /usr/include/g++-3/string:6,
                 from x.cpp:2:
/usr/include/g++-3/std/bastring.h: In method `basic_string<charT, 
traits, Allocator> &basic_string<charT, traits, Allocator>::replace 
(charT *, charT *, InputIterator, InputIterator)':
/usr/include/g++-3/std/bastring.h:442: warning: declaration of `j1' shadows
global declaration
In file included from /usr/include/g++-3/hash_map:31,
                 from x.cpp:3:
/usr/include/g++-3/stl_hashtable.h: In method `void hashtable<_Val, 
_Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc>::_M_copy_from (const 
hashtable<_Val, _Key, _HashFcn, _ExtractKey, _EqualKey, _Alloc> &)':
/usr/include/g++-3/stl_hashtable.h:1017: warning: declaration of `__copy'
shadows global declaration


Expected Results:  I would expect the standard headers to be warning free.


Additional info:

gcc-2.96-108.7.2

Comment 1 Richard Henderson 2004-10-03 00:29:12 UTC
We are in fact warning free for these specific headers in gcc 3.2.