singleton idiom evokes a warning, an error.
Horst von Brand
vonbrand@sleipnir.valparaiso.cl
Tue Dec 8 14:01:00 GMT 1998
Michael Cook <cook@clearviewtech.com> said:
> Here are a couple really old bugs (they predate egcs). They're both
> related to the ubiquitous singleton idiom (where you make the ctor
> and dtor private, and then have a static member function that
> returns the "only" instance of the class).
>
> class x
> {
> x();
> ~x(); //4
> public: static x& only();
> }; //6
>
> x& x::only()
> {
> static x t; //10
> return t;
> }
Fixed in the 19981206 snapshot. OTOH, 1.1.1 gives the same as you get.
Thanks for the report!
--
Horst von Brand vonbrand@sleipnir.valparaiso.cl
Casilla 9G, Viña del Mar, Chile +56 32 672616
More information about the Gcc-bugs
mailing list