home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / gnu / gcc / bug / 3046 < prev    next >
Encoding:
Text File  |  1992-12-23  |  1.4 KB  |  49 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!cis.ohio-state.edu!thymus.synaptics.COM!daveg
  3. From: daveg@thymus.synaptics.COM (Dave Gillespie)
  4. Subject: GCC 2.1 emits a bogus warning
  5. Message-ID: <9212230627.AA10985@thymus.synaptics>
  6. Sender: gnulists@ai.mit.edu
  7. Reply-To: daveg@synaptics.com
  8. Organization: GNUs Not Usenet
  9. Distribution: gnu
  10. Date: Tue, 22 Dec 1992 14:27:06 GMT
  11. Approved: bug-gcc@prep.ai.mit.edu
  12. Lines: 35
  13.  
  14. While porting some code I got the warning,
  15.  
  16. > warning: class `foo' only defines private constructors and
  17. > has no friends
  18.  
  19. which gave me a scare until I realized the class *did* have a
  20. static member function which called "new foo" using the private
  21. constructor.  In fact, I notice the warning even appears if I
  22. put the function body using "new" right there in the class
  23. definition!
  24.  
  25. This warning should probably be suppressed when there are
  26. any public static member functions in the class.
  27.  
  28. A sample file:
  29.  
  30. --------
  31. class foo {
  32.   int x;
  33.   foo(int y) { x = y; }
  34. public:
  35.   static foo *make(int a) { return new foo(a); }
  36. };
  37. --------
  38.  
  39. As far as I know, there is no way to get gcc to suppress this
  40. warning, short of using "-w" to suppress all warnings.  It
  41. would be nice if there were a way to suppress specific warnings,
  42. e.g., a #pragma or special comment that would suppress all
  43. warnings on the following line, or a command-line option that
  44. would suppress all warning messages whose text contains a given
  45. string.
  46.  
  47.                                 -- Dave
  48.  
  49.