🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1223

Bug or feature: shadowing a member of this

#1223
From: H. Vaisanen
Date: Fri, 20 Nov 1992 13:25
20 lines
810 bytes
Should the compiler give this warning?

class Foo {
  int bar;
public:
  int Bar() const {return bar;};
};

main()
{
  int Bar; // `Bar' shadows a member of `this' ??
}
---

% g++ -Wshadow -c a.C
a.C: In function `int  main ()':
a.C:9: warning: declaration of `Bar' shadows a member of `this'
% g++ -v
Reading specs from /usr/local/Gnu/lib/gcc-lib/decstation-3100/2.3.1/specs
gcc version 2.3.1
Technical Details
Message-ID: <9211200925.AA23043@cs.joensuu.fi>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.joensuu.fi!hvaisane

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cs.joensuu.fi!hvaisane
From: hvaisane@cs.joensuu.fi (H. Vaisanen)
Subject: Bug or feature: shadowing a member of this
Message-ID: <9211200925.AA23043@cs.joensuu.fi>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 20 Nov 1992 13:25:18 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 21