public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: bkoz@redhat.com
To: gcc-gnats@gcc.gnu.org
Subject: libstdc++/9780: issues with time_get, time_put not being tied to correct _punct facet.
Date: Thu, 20 Feb 2003 18:36:00 -0000 [thread overview]
Message-ID: <20030220183355.2022.qmail@sources.redhat.com> (raw)
>Number: 9780
>Category: libstdc++
>Synopsis: issues with time_get, time_put not being tied to correct _punct facet.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Feb 20 18:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: bkoz@redhat.com
>Release: gcc-3.2, gcc-3.3, gcc-3.4 not applicable to releases before gcc-3.2
>Organization:
>Environment:
x86/linux, gnu locale model
>Description:
See:
http://gcc.gnu.org/ml/libstdc++/2003-01/msg00363.html
And followups.
Seems like an issue with __timepunct not really being used correctly with time_get and time_put facets.
When fixing this, please double check the other facets for this behavior as well. Likely candidates are money_put, money_get, num_get, num_put, etc: anything that uses a *_punct facet for data collection.
>How-To-Repeat:
#include <iostream>
#include <locale>
int main ()
{
const std::locale loc ("de_DE");
const std::time_put<char> &tpc =
std::use_facet<std::time_put<char> >(loc);
std::tm t = std::tm ();
for (t.tm_wday = 0; t.tm_wday != 7; ++t.tm_wday)
tpc.put (std::cout.rdbuf (), std::cout, ' ', &t, 'A') = '\n';
}
or
#include <iostream>
#include <locale>
int main (int argc, const char *argv[])
{
const std::locale l1 (argc > 1 ? argv [1] : "");
const std::locale l2 (argc > 2 ? argv [2] : "");
const std::locale l1_l2 =
std::locale (std::locale (std::locale::classic (),
&std::use_facet<std::time_get<char>
>(l1)),
&std::use_facet<std::time_put<char> >(l2));
const std::time_get<char> &tg =
std::use_facet<std::time_get<char> >(l1_l2);
const std::time_put<char> &tp =
std::use_facet<std::time_put<char> >(l1_l2);
std::tm t = std::tm ();
std::ios::iostate err = std::ios::goodbit;
// benign but unnecessary
// std::cin.imbue (l1_l2);
// std::cout.imbue (l1_l2);
tg.get_weekday (std::cin.rdbuf (), std::istreambuf_iterator<char>(),
std::cin, err, &t);
if (err & std::ios::failbit)
return 1;
tp.put (std::cout.rdbuf (), std::cout, ' ', &t, 'A') = '\n';
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
next reply other threads:[~2003-02-20 18:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-02-20 18:36 bkoz [this message]
2003-03-11 15:05 bkoz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030220183355.2022.qmail@sources.redhat.com \
--to=bkoz@redhat.com \
--cc=gcc-gnats@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).