wrong warning on private constructors

Stefan Seefeld stefan.seefeld@orthosoft.ca
Tue Dec 17 13:33:00 GMT 2002


Hi there,

Gcc emits a warning about objects containing only private
constructors/destructors. Here is the comment from gcc code:

gcc/cp/class.c:

   /* Even if some of the member functions are non-private, the class
      won't be useful for much if all the constructors or destructors
      are private: such an object can never be created or destroyed.  */

This argument is invalid because the object can also be 
constructed/destructed by other means such as public methods of the same 
object (singleton, reference counting, ...).

Is there a way to disable this warning? Or better even, could this
warning be dropped ?

Regards,

	Stefan



More information about the Gcc mailing list