public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libstdc++/9322: return value of basic_streambuf<>::getloc affected by locale::global
@ 2003-01-15 10:56 peturr02
  0 siblings, 0 replies; 2+ messages in thread
From: peturr02 @ 2003-01-15 10:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9322
>Category:       libstdc++
>Synopsis:       return value of basic_streambuf<>::getloc affected by locale::global
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 15 02:56:01 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     peturr02@ru.is
>Release:        gcc-3.2.1
>Organization:
>Environment:
Red Hat Linux 8.0
>Description:
If basic_streambuf<>::pubimbue() has not been called, the value returned by basic_streambuf<>::getloc() is the current global locale at the time getloc() is called, not the current global locale at the time of construction.

In particular, this means that it is not possible to cache the results of use_facet<>(getloc()), as the lifetime of the locale returned by getloc() is unknown.
>How-To-Repeat:
See attachment.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="imbuebug.cc"
Content-Disposition: inline; filename="imbuebug.cc"

#include <locale>
#include <streambuf>

using namespace std;

class Mybuf : public streambuf
{
};

#undef NDEBUG
#include <cassert>

int main()
{
	Mybuf buf;
	locale loc1 = buf.getloc();
	
	locale::global(locale(""));

	locale loc2 = buf.getloc();
	assert(loc1 == loc2);

	return 0;
}


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

* Re: libstdc++/9322: return value of basic_streambuf<>::getloc affected by locale::global
@ 2003-02-01 21:59 paolo
  0 siblings, 0 replies; 2+ messages in thread
From: paolo @ 2003-02-01 21:59 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, peturr02

Synopsis: return value of basic_streambuf<>::getloc affected by locale::global

State-Changed-From-To: open->closed
State-Changed-By: paolo
State-Changed-When: Sat Feb  1 21:59:11 2003
State-Changed-Why:
    Fixed

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9322


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

end of thread, other threads:[~2003-02-01 21:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-15 10:56 libstdc++/9322: return value of basic_streambuf<>::getloc affected by locale::global peturr02
2003-02-01 21:59 paolo

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