There is currently a bug with std::showpos with the older
version of libstdc++-v3 that is bundled with gcc 4.2.1
in-tree. It was exposed by the Gnash testsuite when
dates were not being formatted correctly showing
GMT00000 instead of GMT+0000 as expected.



2007-11-26  Paolo Carlini  <pcarl...@suse.de>

        * include/bits/locale_facets.tcc (num_put<>::_M_insert_int): When
        ios_base::showpos and the type is signed and the value is zero,
        prepend +.


Index: gnu/gcc/libstdc++-v3/include/bits/locale_facets.tcc
===================================================================
RCS file: /home/cvs/src/gnu/gcc/libstdc++-v3/include/bits/locale_facets.tcc,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 locale_facets.tcc
--- gnu/gcc/libstdc++-v3/include/bits/locale_facets.tcc 15 Oct 2009 17:11:32 
-0000      1.1.1.1
+++ gnu/gcc/libstdc++-v3/include/bits/locale_facets.tcc 6 Feb 2011 21:40:46 
-0000
@@ -1015,13 +1015,13 @@ _GLIBCXX_BEGIN_LDBL_NAMESPACE
        if (__builtin_expect(__dec, true))
          {
            // Decimal.
-           if (__v > 0)
+           if (__v >= 0)
              {
                if (__flags & ios_base::showpos
                    && numeric_limits<_ValueT>::is_signed)
                  *--__cs = __lit[__num_base::_S_oplus], ++__len;
              }
-           else if (__v)
+           else
              *--__cs = __lit[__num_base::_S_ominus], ++__len;
          }
        else if (__flags & ios_base::showbase && __v)

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Reply via email to