home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / gnu / g / bug / 1850 < prev    next >
Encoding:
Text File  |  1992-11-20  |  779 b   |  34 lines

  1. Newsgroups: gnu.g++.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!cs.joensuu.fi!hvaisane
  3. From: hvaisane@cs.joensuu.fi (H. Vaisanen)
  4. Subject: Bug or feature: shadowing a member of this
  5. Message-ID: <9211200925.AA23043@cs.joensuu.fi>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Fri, 20 Nov 1992 13:25:18 GMT
  10. Approved: bug-g++@prep.ai.mit.edu
  11. Lines: 21
  12.  
  13. Should the compiler give this warning?
  14.  
  15. class Foo {
  16.   int bar;
  17. public:
  18.   int Bar() const {return bar;};
  19. };
  20.  
  21. main()
  22. {
  23.   int Bar; // `Bar' shadows a member of `this' ??
  24. }
  25. ---
  26.  
  27. % g++ -Wshadow -c a.C
  28. a.C: In function `int  main ()':
  29. a.C:9: warning: declaration of `Bar' shadows a member of `this'
  30. % g++ -v
  31. Reading specs from /usr/local/Gnu/lib/gcc-lib/decstation-3100/2.3.1/specs
  32. gcc version 2.3.1
  33.  
  34.