public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/9027: codecvt example from The C++ Programming Language does not work.
@ 2003-05-16 23:46 Benjamin Kosnik
0 siblings, 0 replies; 5+ messages in thread
From: Benjamin Kosnik @ 2003-05-16 23:46 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR libstdc++/9027; it has been noted by GNATS.
From: Benjamin Kosnik <bkoz@redhat.com>
To: gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: libstdc++/9027: codecvt example from The C++ Programming
Language does not work.
Date: Fri, 16 May 2003 18:41:18 -0500
>It's not a regression, is it? If it's not a regression, it can be closed.
>3.3 branch is open only for regression fixes.
No, it's never worked until mainline recently. Can I close this?
-benjamin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: libstdc++/9027: codecvt example from The C++ Programming Language does not work.
@ 2003-05-16 22:36 Giovanni Bajo
0 siblings, 0 replies; 5+ messages in thread
From: Giovanni Bajo @ 2003-05-16 22:36 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR libstdc++/9027; it has been noted by GNATS.
From: "Giovanni Bajo" <giovannibajo@libero.it>
To: <gcc-prs@gcc.gnu.org>,
<peturr02@ru.is>,
<gcc-bugs@gcc.gnu.org>,
<gcc-gnats@gcc.gnu.org>,
<nobody@gcc.gnu.org>
Cc: <bkoz@redhat.com>
Subject: Re: libstdc++/9027: codecvt example from The C++ Programming Language does not work.
Date: Sat, 17 May 2003 00:33:42 +0200
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9027
>This is fixed on mainline, but not on the 3.3.x branch. Should this just be
closed?
It's not a regression, is it? If it's not a regression, it can be closed.
3.3 branch is open only for regression fixes.
Giovanni Bajo
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: libstdc++/9027: codecvt example from The C++ Programming Language does not work.
@ 2003-05-16 19:58 bkoz
0 siblings, 0 replies; 5+ messages in thread
From: bkoz @ 2003-05-16 19:58 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, peturr02
Synopsis: codecvt example from The C++ Programming Language does not work.
State-Changed-From-To: analyzed->feedback
State-Changed-By: bkoz
State-Changed-When: Fri May 16 19:58:26 2003
State-Changed-Why:
This is fixed on mainline, but not on the 3.3.x branch. Should this just be closed?
-benjamin
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9027
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: libstdc++/9027: codecvt example from The C++ Programming Language does not work.
@ 2002-12-21 7:45 paolo
0 siblings, 0 replies; 5+ messages in thread
From: paolo @ 2002-12-21 7:45 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, peturr02
Synopsis: codecvt example from The C++ Programming Language does not work.
State-Changed-From-To: open->analyzed
State-Changed-By: paolo
State-Changed-When: Sat Dec 21 07:45:21 2002
State-Changed-Why:
Confirmed. Seems however a known problem, see the thread
starting from:
http://gcc.gnu.org/ml/libstdc++/2002-09/msg00055.html
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9027
^ permalink raw reply [flat|nested] 5+ messages in thread
* libstdc++/9027: codecvt example from The C++ Programming Language does not work.
@ 2002-12-20 7:16 peturr02
0 siblings, 0 replies; 5+ messages in thread
From: peturr02 @ 2002-12-20 7:16 UTC (permalink / raw)
To: gcc-gnats
>Number: 9027
>Category: libstdc++
>Synopsis: codecvt example from The C++ Programming Language does not work.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Dec 20 07:16:14 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: peturr02@ru.is
>Release: gcc-3.2.1
>Organization:
>Environment:
Red Hat Linux 8.0 on i686; glibc-2.2.93
>Description:
In appendix D of The C++ Programming Language, 3rd edition <http://www.research.att.com/~bs/3rd_loc.pdf> Stroustrup describes a codecvt facet that converts input to uppercase.
This example doesn't work on gcc-3.2.1, as basic_filebuf<char> never calls codecvt<char, char, mbstate_t>::in().
>How-To-Repeat:
See attachment for a modified version of the example.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="charupper.cc"
Content-Disposition: inline; filename="charupper.cc"
#include <locale>
#include <algorithm>
#include <cstddef>
#include <cstdio>
#include <string>
#include <fstream>
#include <iostream>
using namespace std;
class Cvt_to_upper : public codecvt<char, char, mbstate_t>
{
typedef codecvt<char, char, mbstate_t> Base;
public:
explicit Cvt_to_upper(size_t refs = 0)
: Base(refs)
{
}
protected:
result do_in(state_type&,
const extern_type* from, const extern_type* from_end,
const extern_type*& from_next,
intern_type* to, intern_type* to_end,
intern_type*& to_next) const
{
while (from < from_end && to < to_end)
*to++ = toupper(*from++);
to_next = to;
from_next = from;
return from == from_end ? ok : partial;
}
bool do_always_noconv() const throw()
{
return false;
}
};
int main()
{
locale loc1;
locale loc (loc1, new Cvt_to_upper);
char name[] = "charupperXXXXXX";
mktemp(name);
string str ("abcdefghijklmnopqrstuvwxyz");
string tmp;
{
ofstream out (name);
copy(str.begin(), str.end(),
ostreambuf_iterator<char>(out));
}
{
ifstream in;
in.imbue(loc);
in.open(name);
copy(istreambuf_iterator<char>(in),
istreambuf_iterator<char>(),
back_inserter(tmp));
}
remove(name);
cout << tmp << endl;
assert(tmp.size() == str.size());
for (size_t i = 0; i < tmp.size(); ++i)
assert(isupper(tmp[i]));
return 0;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2003-05-16 23:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-16 23:46 libstdc++/9027: codecvt example from The C++ Programming Language does not work Benjamin Kosnik
-- strict thread matches above, loose matches on Subject: below --
2003-05-16 22:36 Giovanni Bajo
2003-05-16 19:58 bkoz
2002-12-21 7:45 paolo
2002-12-20 7:16 peturr02
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).