public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: PATCH: Testcase for new C++ bug? Comments please.
  1998-07-03  0:50 ` PATCH: Testcase for new C++ bug? Comments please Carlo Wood
@ 1998-07-03  0:12   ` Martin von Loewis
  1998-07-03  8:38     ` Klaus-Georg Adams
  0 siblings, 1 reply; 4+ messages in thread
From: Martin von Loewis @ 1998-07-03  0:12 UTC (permalink / raw)
  To: carlo; +Cc: Klaus-Georg.Adams, egcs

> But what if you want to see that warning for other objects?

Just compile a single file with this flag.

Martin

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

* Re: PATCH: Testcase for new C++ bug? Comments please.
       [not found] <199807021835.UAA17773@mira.isdn.cs.tu-berlin.de>
@ 1998-07-03  0:50 ` Carlo Wood
  1998-07-03  0:12   ` Martin von Loewis
  0 siblings, 1 reply; 4+ messages in thread
From: Carlo Wood @ 1998-07-03  0:50 UTC (permalink / raw)
  To: Martin von Loewis, Klaus-Georg.Adams; +Cc: egcs

| The warning as worded is technically correct; and a compliant
| implementation is free to produce whatever messages it likes.
| 
| It may be annoying; you can use -Wno-ctor-dtor-privacy to shut it up.

I can't resist :).  This is a nice example of why a #pragma
is favourable to turn off warnings.
When someone insists on having NO warnings, and hence uses
-Werror in order to stop the compilation of 30 minutes
whenever a warning happens - then indeed this single singleton
would force you to use -Wno-ctor-dtor-privacy.
But what if you want to see that warning for other objects?
Then there is a need to turn the warning off for just that one class.

-- 
 Carlo Wood  <carlo@runaway.xs4all.nl>

PS In the meantime you might be helped by using the trick to
   add a dummy friend class :)
   friend class yeah_sure;

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

* Re: PATCH: Testcase for new C++ bug? Comments please.
  1998-07-03  0:12   ` Martin von Loewis
@ 1998-07-03  8:38     ` Klaus-Georg Adams
  1998-07-03 12:21       ` Martin von Loewis
  0 siblings, 1 reply; 4+ messages in thread
From: Klaus-Georg Adams @ 1998-07-03  8:38 UTC (permalink / raw)
  To: martin; +Cc: carlo, egcs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1265 bytes --]

>>>>> "Martin" == Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de> writes:

    >> But what if you want to see that warning for other objects?
    Martin> Just compile a single file with this flag.

This won't help you, because the warning is given in every file which
#include's the interface of the singleton (and you would have to chase
them all in the Makefile). Not a realistic option. If you have a
single header which causes this warning, you have to turn it off for
the entire compilation.

It is not a #pragma that is needed (although it would help to kludge
around the problem), but the warning has to be fixed.  It makes sense
to warn about a class that is completely inaccesible. But this is not
the case here.

Note: I don't know the internals of gcc, but if it can check for
private ctor and dtors, it could just as well check for static public
functions returning an object of the offending class.

-- kga
-------------------------------------------------------------------------
Klaus-Georg Adams        Email: Klaus-Georg.Adams@chemie.uni-karlsruhe.de
Institut f. Anorg. Chemie, Lehrstuhl II            Tel: 49(0)721 608 3485
Universität Karlsruhe, D-76128 Karlsruhe
-------------------------------------------------------------------------

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

* Re: PATCH: Testcase for new C++ bug? Comments please.
  1998-07-03  8:38     ` Klaus-Georg Adams
@ 1998-07-03 12:21       ` Martin von Loewis
  0 siblings, 0 replies; 4+ messages in thread
From: Martin von Loewis @ 1998-07-03 12:21 UTC (permalink / raw)
  To: Klaus-Georg.Adams; +Cc: carlo, egcs

> Note: I don't know the internals of gcc, but if it can check for
> private ctor and dtors, it could just as well check for static public
> functions returning an object of the offending class.

If it gets fixed, it should get fixed for good. So if you don't
complain in this case, somebody will write a class that has a static
function with a static variable, but does not return this variable;
and it will be a meaningful application.

The tricky part is not to implement some criterion, but to come up
with a good one.

Martin

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

end of thread, other threads:[~1998-07-03 12:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <199807021835.UAA17773@mira.isdn.cs.tu-berlin.de>
1998-07-03  0:50 ` PATCH: Testcase for new C++ bug? Comments please Carlo Wood
1998-07-03  0:12   ` Martin von Loewis
1998-07-03  8:38     ` Klaus-Georg Adams
1998-07-03 12:21       ` Martin von Loewis

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).