public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: wrong warning on private constructors
@ 2002-12-17 13:42 Wolfgang Bangerth
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Bangerth @ 2002-12-17 13:42 UTC (permalink / raw)
  To: gcc, gdr, Stefan Seefeld


> | Is there a way to disable this warning? Or better even, could this
> | warning be dropped ?
>
> I think the logic used in the implementation is broken. 

Right. I find the warning equally unuseful, in particular since it warns
about something that you will notice anyway. Warnings should warn about
things that will go wrong when a variable/function/class is used and there
is a risk that the user might not notice. But in this case the warning
warns you when you don't even attempt to use the class, and when you use
it you get the warning _plus_ the errors about private constructors etc.

The only situation I can imagine where this is useful is that some library
author writes a public class and never even tries to instantiate it in his
own library, program, or testcases. This should be a case that is rare 
enough not to warrant this warning.

Regards
  Wolfgang

-------------------------------------------------------------------------
Wolfgang Bangerth              email:           bangerth@ticam.utexas.edu
                               www: http://www.ticam.utexas.edu/~bangerth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: wrong warning on private constructors
  2002-12-17 13:34 ` Gabriel Dos Reis
@ 2002-12-17 13:37   ` Stefan Seefeld
  0 siblings, 0 replies; 4+ messages in thread
From: Stefan Seefeld @ 2002-12-17 13:37 UTC (permalink / raw)
  To: gcc

Gabriel Dos Reis wrote:

> I think the logic used in the implementation is broken.  I'm not
> sanguine about dropping the warning (although I suspect that people
> would suddendly fill reports).  Maybe a workable way would be to find
> an exhaustive criterioon (no friends, no public memeber function) that
> would make that warning unbroken. 

oh, sure. It's certainly possible from within gcc to test whether
the class is usable, and to emit that warning in case it *really* is
not. I just thought that not emitting that warning is better than
emitting it always, which is wrong.

Thanks,
		Stefa




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: wrong warning on private constructors
  2002-12-17 13:33 Stefan Seefeld
@ 2002-12-17 13:34 ` Gabriel Dos Reis
  2002-12-17 13:37   ` Stefan Seefeld
  0 siblings, 1 reply; 4+ messages in thread
From: Gabriel Dos Reis @ 2002-12-17 13:34 UTC (permalink / raw)
  To: Stefan Seefeld; +Cc: gcc

Stefan Seefeld <stefan.seefeld@orthosoft.ca> writes:

[...]

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

I think the logic used in the implementation is broken.  I'm not
sanguine about dropping the warning (although I suspect that people
would suddendly fill reports).  Maybe a workable way would be to find
an exhaustive criterioon (no friends, no public memeber function) that
would make that warning unbroken. 

-- Gaby

^ permalink raw reply	[flat|nested] 4+ messages in thread

* wrong warning on private constructors
@ 2002-12-17 13:33 Stefan Seefeld
  2002-12-17 13:34 ` Gabriel Dos Reis
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Seefeld @ 2002-12-17 13:33 UTC (permalink / raw)
  To: gcc

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-12-17 21:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-17 13:42 wrong warning on private constructors Wolfgang Bangerth
  -- strict thread matches above, loose matches on Subject: below --
2002-12-17 13:33 Stefan Seefeld
2002-12-17 13:34 ` Gabriel Dos Reis
2002-12-17 13:37   ` Stefan Seefeld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).