public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11528] New: money_get does not get "$.00"
@ 2003-07-15 18:06 paul at serice dot net
  2003-07-15 18:52 ` [Bug libstdc++/11528] " bangerth at dealii dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: paul at serice dot net @ 2003-07-15 18:06 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11528

           Summary: money_get does not get "$.00"
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: paul at serice dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

I'm having a problem on gcc-3.2.3 and gcc-3.3 getting the money_get facet to
parse "$.00".  It is happy with things like "$.01" though.  (I haven't been able
to test it with anything more recent because I'm getting errors every time I try
to compile something from cvs.)

The problem is reproduced in the following code.  After compiling, I run it as

    LANG=en_US.UTF8 ./main

The output I get is

    amount = 5
    amount = 4
    amount = 3
    amount = 2
    amount = 1
    amount = <error>

The "<error>" corresponds to "$.00".

===================

#include <locale>
#include <string>
#include <sstream>
#include <iostream>

using namespace std;

namespace {

    void doit(const string& amount)
    {
        // Use a non-trivial locale by setting LANG=en_US.UTF8 (for
        // example).
        istringstream istrm(amount);
        istrm.imbue(locale(""));

        // Retrieve the money_get facet.
        const money_get<char>& mgf =
            use_facet< money_get <char> >(istrm.getloc());

        // Use the facet to extract the amount from istrm.
        string extracted_amount;
        ios_base::iostate err = ios_base::iostate(0);
        mgf.get(istrm, 0, false, istrm, err, extracted_amount);

        // Check for errors.
        if( err & ios_base::failbit ) {
            extracted_amount = "<error>";
        }

        // What did we get?
        cout << "amount = " << extracted_amount << endl;
    }

}

int main(int argc, char* argv[])
{
    int rv = 0;
    doit("$.05");
    doit("$.04");
    doit("$.03");
    doit("$.02");
    doit("$.01");
    doit("$.00");
    return rv;
}


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

* [Bug libstdc++/11528] money_get does not get "$.00"
  2003-07-15 18:06 [Bug c++/11528] New: money_get does not get "$.00" paul at serice dot net
@ 2003-07-15 18:52 ` bangerth at dealii dot org
  2003-07-15 22:50 ` paolo at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: bangerth at dealii dot org @ 2003-07-15 18:52 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11528


bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |libstdc++


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

* [Bug libstdc++/11528] money_get does not get "$.00"
  2003-07-15 18:06 [Bug c++/11528] New: money_get does not get "$.00" paul at serice dot net
  2003-07-15 18:52 ` [Bug libstdc++/11528] " bangerth at dealii dot org
@ 2003-07-15 22:50 ` paolo at gcc dot gnu dot org
  2003-07-16 16:12 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu dot org @ 2003-07-15 22:50 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11528


paolo at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |paolo at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-07-15 22:50:42
               date|                            |


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

* [Bug libstdc++/11528] money_get does not get "$.00"
  2003-07-15 18:06 [Bug c++/11528] New: money_get does not get "$.00" paul at serice dot net
  2003-07-15 18:52 ` [Bug libstdc++/11528] " bangerth at dealii dot org
  2003-07-15 22:50 ` paolo at gcc dot gnu dot org
@ 2003-07-16 16:12 ` cvs-commit at gcc dot gnu dot org
  2003-07-17 10:12 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-07-16 16:12 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11528



------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-07-16 16:12 -------
Subject: Bug 11528

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	paolo@gcc.gnu.org	2003-07-16 16:12:47

Modified files:
	libstdc++-v3   : ChangeLog 
	libstdc++-v3/include/bits: locale_facets.tcc 
Added files:
	libstdc++-v3/testsuite/22_locale/money_get/get/char: 11528.cc 
	libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t: 11528.cc 

Log message:
	2003-07-16  Paolo Carlini  <pcarlini@unitus.it>
	
	PR libstdc++/11528
	* include/bits/locale_facets.tcc (money_get::do_get):
	Strip only _leading_ zeros.
	* testsuite/22_locale/money_get/get/char/11528.cc: Add.
	* testsuite/22_locale/money_get/get/wchar_t/11528.cc: Add.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.1883&r2=1.1884
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/locale_facets.tcc.diff?cvsroot=gcc&r1=1.107&r2=1.108
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/22_locale/money_get/get/char/11528.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/22_locale/money_get/get/wchar_t/11528.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1


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

* [Bug libstdc++/11528] money_get does not get "$.00"
  2003-07-15 18:06 [Bug c++/11528] New: money_get does not get "$.00" paul at serice dot net
                   ` (2 preceding siblings ...)
  2003-07-16 16:12 ` cvs-commit at gcc dot gnu dot org
@ 2003-07-17 10:12 ` cvs-commit at gcc dot gnu dot org
  2003-07-17 10:13 ` paolo at gcc dot gnu dot org
  2003-07-25 23:28 ` jbuck at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-07-17 10:12 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11528



------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-07-17 10:12 -------
Subject: Bug 11528

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	paolo@gcc.gnu.org	2003-07-17 10:12:24

Modified files:
	libstdc++-v3   : ChangeLog 
	libstdc++-v3/include/bits: locale_facets.tcc 

Log message:
	2003-07-17  Paolo Carlini  <pcarlini@unitus.it>
	
	PR libstdc++/11528
	* include/bits/locale_facets.tcc (money_get::do_get):
	Strip only _leading_ zeros.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.1464.2.135&r2=1.1464.2.136
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/locale_facets.tcc.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.82.4.12&r2=1.82.4.13


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

* [Bug libstdc++/11528] money_get does not get "$.00"
  2003-07-15 18:06 [Bug c++/11528] New: money_get does not get "$.00" paul at serice dot net
                   ` (3 preceding siblings ...)
  2003-07-17 10:12 ` cvs-commit at gcc dot gnu dot org
@ 2003-07-17 10:13 ` paolo at gcc dot gnu dot org
  2003-07-25 23:28 ` jbuck at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu dot org @ 2003-07-17 10:13 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11528


paolo at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


------- Additional Comments From paolo at gcc dot gnu dot org  2003-07-17 10:13 -------
Fixed for 3.3.1 and 3.4.


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

* [Bug libstdc++/11528] money_get does not get "$.00"
  2003-07-15 18:06 [Bug c++/11528] New: money_get does not get "$.00" paul at serice dot net
                   ` (4 preceding siblings ...)
  2003-07-17 10:13 ` paolo at gcc dot gnu dot org
@ 2003-07-25 23:28 ` jbuck at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jbuck at gcc dot gnu dot org @ 2003-07-25 23:28 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11528


jbuck at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|3.4                         |3.3.1


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

end of thread, other threads:[~2003-07-25 23:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-15 18:06 [Bug c++/11528] New: money_get does not get "$.00" paul at serice dot net
2003-07-15 18:52 ` [Bug libstdc++/11528] " bangerth at dealii dot org
2003-07-15 22:50 ` paolo at gcc dot gnu dot org
2003-07-16 16:12 ` cvs-commit at gcc dot gnu dot org
2003-07-17 10:12 ` cvs-commit at gcc dot gnu dot org
2003-07-17 10:13 ` paolo at gcc dot gnu dot org
2003-07-25 23:28 ` jbuck at gcc dot gnu dot org

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