]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
regex.tcc: Remove incorrect `nosubs` handling.
authorTim Shen <timshen91@gmail.com>
Tue, 21 Jan 2014 19:54:03 +0000 (19:54 +0000)
committerTim Shen <timshen@gcc.gnu.org>
Tue, 21 Jan 2014 19:54:03 +0000 (19:54 +0000)
2014-01-21  Tim Shen  <timshen91@gmail.com>

* include/bits/regex.tcc: Remove incorrect `nosubs` handling.
* include/bits/regex_scanner.tcc: Handle `nosubs` correctly.
* testsuite/28_regex/constants/syntax_option_type.cc: Add a test case.

From-SVN: r206906

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/regex.tcc
libstdc++-v3/include/bits/regex_scanner.tcc
libstdc++-v3/testsuite/28_regex/constants/syntax_option_type.cc

index 879efe887a15bb6bb853146fcbf4c25af7129905..bc1803eb5bf7d22bb6142b09c1a0f860b599573f 100644 (file)
@@ -1,3 +1,9 @@
+2014-01-21  Tim Shen  <timshen91@gmail.com>
+
+       * include/bits/regex.tcc: Remove incorrect `nosubs` handling.
+       * include/bits/regex_scanner.tcc: Handle `nosubs` correctly.
+       * testsuite/28_regex/constants/syntax_option_type.cc: Add a test case.
+
 2014-01-21  Jonathan Wakely  <jwakely@redhat.com>
 
        PR libstdc++/56267
index 1ceac60234401eaf8a843f9be13f15e540e01b5e..73f55dfc5f6d740991a726dd37e3a2e0a1fe416e 100644 (file)
@@ -126,8 +126,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
              __suf.second = __e;
              __suf.matched = (__suf.first != __suf.second);
            }
-         if (__re.flags() & regex_constants::nosubs)
-           __res.resize(3);
        }
       return __ret;
     }
index d954d0764e263358b78c65b3008413878b1d3c59..5332d2eff84f4cf082766d5092bde71bf33a8baa 100644 (file)
@@ -139,6 +139,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
              else
                __throw_regex_error(regex_constants::error_paren);
            }
+         else if (_M_flags & regex_constants::nosubs)
+           _M_token = _S_token_subexpr_no_group_begin;
          else
            _M_token = _S_token_subexpr_begin;
        }
index 22559f51eb232cd557531e4bdddb2b927501134e..2423775e114d2176c5903749d768031691b55998 100644 (file)
@@ -1,5 +1,4 @@
 // { dg-options "-std=c++0x" }
-// { dg-do compile }
 //
 // 2009-06-17  Stephen M. Webb  <stephen.webb@xandros.com>
 //
@@ -23,6 +22,7 @@
 // 28.5.1 
 
 #include <regex>
+#include <testsuite_hooks.h>
 
 void
 test01()
@@ -82,10 +82,21 @@ test04_constexpr()
   constexpr auto a3 __attribute__((unused)) = ~grep;
 }
 
+void
+test05()
+{
+  using namespace std;
+  using namespace regex_constants;
+  regex re("((a)(s))", nosubs | ECMAScript);
+  VERIFY(re.mark_count() == 0);
+}
+
 int main()
 {
   test01();
   test02();
   test03();
+  test04_constexpr();
+  test05();
   return 0;
 }