Commit 8f7082f5 by Tim Shen Committed by Tim Shen

regex.tcc: Remove incorrect `nosubs` handling.

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
parent 6ff956e3
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> 2014-01-21 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/56267 PR libstdc++/56267
......
...@@ -126,8 +126,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -126,8 +126,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__suf.second = __e; __suf.second = __e;
__suf.matched = (__suf.first != __suf.second); __suf.matched = (__suf.first != __suf.second);
} }
if (__re.flags() & regex_constants::nosubs)
__res.resize(3);
} }
return __ret; return __ret;
} }
......
...@@ -139,6 +139,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -139,6 +139,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
else else
__throw_regex_error(regex_constants::error_paren); __throw_regex_error(regex_constants::error_paren);
} }
else if (_M_flags & regex_constants::nosubs)
_M_token = _S_token_subexpr_no_group_begin;
else else
_M_token = _S_token_subexpr_begin; _M_token = _S_token_subexpr_begin;
} }
......
// { dg-options "-std=c++0x" } // { dg-options "-std=c++0x" }
// { dg-do compile }
// //
// 2009-06-17 Stephen M. Webb <stephen.webb@xandros.com> // 2009-06-17 Stephen M. Webb <stephen.webb@xandros.com>
// //
...@@ -23,6 +22,7 @@ ...@@ -23,6 +22,7 @@
// 28.5.1 // 28.5.1
#include <regex> #include <regex>
#include <testsuite_hooks.h>
void void
test01() test01()
...@@ -82,10 +82,21 @@ test04_constexpr() ...@@ -82,10 +82,21 @@ test04_constexpr()
constexpr auto a3 __attribute__((unused)) = ~grep; 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() int main()
{ {
test01(); test01();
test02(); test02();
test03(); test03();
test04_constexpr();
test05();
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment