re PR libstdc++/64441 (A match_results returns an incorrect sub_match if the sub_matc...
authorTim Shen <timshen@google.com>
Wed, 31 Dec 2014 10:27:41 +0000 (10:27 +0000)
committerTim Shen <timshen@gcc.gnu.org>
Wed, 31 Dec 2014 10:27:41 +0000 (10:27 +0000)
PR libstdc++/64441
* include/bits/regex.tcc (__regex_algo_impl): s/auto/auto&/.
* include/bits/regex_executor.tcc (_Executor<>::_M_dfs): Likewise.

From-SVN: r219121

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/regex.tcc
libstdc++-v3/include/bits/regex_executor.tcc

index 597473194034aed42a611e2726ffc75d53a44340..cb01af039305e59ee8e6219f2459ce4d2f1cce9f 100644 (file)
@@ -1,3 +1,9 @@
+2014-12-31  Tim Shen  <timshen@google.com>
+
+       PR libstdc++/64441
+       * include/bits/regex.tcc (__regex_algo_impl): s/auto/auto&/.
+       * include/bits/regex_executor.tcc (_Executor<>::_M_dfs): Likewise.
+
 2014-12-28  David Edelsohn  <dje.gcc@gmail.com>
 
        * testsuite/26_numerics/headers/cmath/c99_classification_macros_c.cc:
index 0206a6cf0e1f13ae2fe4b2de6861e9d6c9c75871..b541446422b3ccafdf17a6c7ca3f7284d26cd9f3 100644 (file)
@@ -96,7 +96,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        }
       if (__ret)
        {
-         for (auto __it : __res)
+         for (auto& __it : __res)
            if (!__it.matched)
              __it.first = __it.second = __e;
          auto& __pre = __res[__res.size()-2];
index a9736675bf60a70164b108fe8e5f3d05078ec58f..7954d06eb3ff5183f667578b9b15a131d5ced845 100644 (file)
@@ -310,7 +310,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
            if (!__submatch.matched)
              break;
            auto __last = _M_current;
-           for (auto __tmp = __submatch.first;
+           for (auto& __tmp = __submatch.first;
                 __last != _M_end && __tmp != __submatch.second;
                 ++__tmp)
              ++__last;