home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / gnu / gcc / bug / 2000 < prev    next >
Encoding:
Text File  |  1992-07-28  |  1.1 KB  |  45 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!forseti.css.gov!tanida
  3. From: tanida@forseti.css.gov (Tom Tanida)
  4. Subject: Suggestion for a Warning for g++
  5. Message-ID: <9207272132.AA13851@forseti.css.gov>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Mon, 27 Jul 1992 21:32:10 GMT
  10. Approved: bug-gcc@prep.ai.mit.edu
  11. Lines: 32
  12.  
  13. I'm using g++ 2.2.2, and am compiling the following:
  14.  
  15. class A {
  16. public:
  17.   virtual void f() const;
  18. };
  19.  
  20. class B: public A {
  21. public:
  22.   virtual void f();
  23. };
  24.  
  25. main()
  26. {
  27. }
  28.  
  29. This compiles cleanly, with no warnings (even with the switches
  30. -Wall and -Woverloaded-virtual).  Under Borland C++ 3.1 I get:
  31.  
  32. Warning: B::f() hides virtual function A::f()
  33.  
  34. This warning is a reasonable one.  I got the idea to try this
  35. from the "Effective C++" book by Scott Meyers (Addison-Wesley); it's
  36. Tip #48 or so- there's a reference to the ARM as to why this 
  37. warning might be a good one to have.
  38.  
  39. -Tom
  40. tanida@esosun.css.gov
  41.  
  42. P.S. You've probably already heard this complaint, but I just thought I'd
  43. send it just in case. :-)
  44.  
  45.