* include/std/iomanip (_Quoted_string operator>>): Do not clear
   string if input is not quoted.

Currently the string is cleared regardless of
how the string is handled. This patch just
moves the clearing down so that we do not clear
it if we are not going to quote the string
(i.e. let operator>> handle the clearing if needed)
and also not if we encounter any stream error.

This has been reported as (bug 60270).

I have no GCC paperwork in order, but I expect this change
to be simple enough to not require that.

---
 libstdc++-v3/include/std/iomanip | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/iomanip b/libstdc++-v3/include/std/iomanip
index b2c7b95..73822db 100644
--- a/libstdc++-v3/include/std/iomanip
+++ b/libstdc++-v3/include/std/iomanip
@@ -415,8 +415,6 @@ _GLIBCXX_END_NAMESPACE_VERSION
                 const _Quoted_string<basic_string<_CharT, _Traits, _Alloc>&,
                                      _CharT>& __str)
       {
-       __str._M_string.clear();
-
        _CharT __c;
        __is >> __c;
        if (!__is.good())
@@ -427,6 +425,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
            __is >> __str._M_string;
            return __is;
          }
+       __str._M_string.clear();
        std::ios_base::fmtflags __flags
          = __is.flags(__is.flags() & ~std::ios_base::skipws);
        do
-- 
1.9.0


-- 
        Lgb

Reply via email to