summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2014-06-03 17:26:15 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2014-06-03 17:26:15 +0000
commitca6601d19f8e03b9b2feaa20fc979b5a6d8d06bd (patch)
treea311cd92f4682d2a74ea2d9b7188e1664684584f /libstdc++-v3
parent5f78ad884e0c5e66a104d0a5f73ea124b6afcc55 (diff)
downloadppe42-gcc-ca6601d19f8e03b9b2feaa20fc979b5a6d8d06bd.tar.gz
ppe42-gcc-ca6601d19f8e03b9b2feaa20fc979b5a6d8d06bd.zip
Backport from mainline
2014-04-24 Tim Shen <timshen91@gmail.com> * include/bits/regex_automaton.tcc (_StateSeq<>::_M_clone()): Do _M_alt before _M_next. * testsuite/28_regex/basic_regex/multiple_quantifiers.cc: Add testcases. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_9-branch@211191 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog7
-rw-r--r--libstdc++-v3/include/bits/regex_automaton.tcc14
-rw-r--r--libstdc++-v3/testsuite/28_regex/basic_regex/multiple_quantifiers.cc4
3 files changed, 17 insertions, 8 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 940d1649cee..ff1e3daec35 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -6,6 +6,13 @@
PR libstdc++/60734
* include/bits/stl_tree.h (_Rb_tree::_M_end): Fix invalid cast.
+ Backport from mainline
+ 2014-04-24 Tim Shen <timshen91@gmail.com>
+
+ * include/bits/regex_automaton.tcc (_StateSeq<>::_M_clone()):
+ Do _M_alt before _M_next.
+ * testsuite/28_regex/basic_regex/multiple_quantifiers.cc: Add testcases.
+
2014-05-29 Jonathan Wakely <jwakely@redhat.com>
* include/tr2/bool_set: Use UTF-8 for accented characters.
diff --git a/libstdc++-v3/include/bits/regex_automaton.tcc b/libstdc++-v3/include/bits/regex_automaton.tcc
index 1a5bf08026f..6e68fca82f1 100644
--- a/libstdc++-v3/include/bits/regex_automaton.tcc
+++ b/libstdc++-v3/include/bits/regex_automaton.tcc
@@ -197,20 +197,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// _M_insert_state() never return -1
auto __id = _M_nfa._M_insert_state(__dup);
__m[__u] = __id;
- if (__u == _M_end)
- continue;
- if (__dup._M_next != _S_invalid_state_id && __m[__dup._M_next] == -1)
- __stack.push(__dup._M_next);
if (__dup._M_opcode == _S_opcode_alternative
|| __dup._M_opcode == _S_opcode_subexpr_lookahead)
if (__dup._M_alt != _S_invalid_state_id && __m[__dup._M_alt] == -1)
__stack.push(__dup._M_alt);
+ if (__u == _M_end)
+ continue;
+ if (__dup._M_next != _S_invalid_state_id && __m[__dup._M_next] == -1)
+ __stack.push(__dup._M_next);
}
- long __size = static_cast<long>(__m.size());
- for (long __k = 0; __k < __size; __k++)
+ for (auto __v : __m)
{
- long __v;
- if ((__v = __m[__k]) == -1)
+ if (__v == -1)
continue;
auto& __ref = _M_nfa[__v];
if (__ref._M_next != _S_invalid_state_id)
diff --git a/libstdc++-v3/testsuite/28_regex/basic_regex/multiple_quantifiers.cc b/libstdc++-v3/testsuite/28_regex/basic_regex/multiple_quantifiers.cc
index 5670cbb8e3b..8243eea930a 100644
--- a/libstdc++-v3/testsuite/28_regex/basic_regex/multiple_quantifiers.cc
+++ b/libstdc++-v3/testsuite/28_regex/basic_regex/multiple_quantifiers.cc
@@ -21,7 +21,10 @@
// Tests multiple consecutive quantifiers
#include <regex>
+#include <testsuite_hooks.h>
+#include <testsuite_regex.h>
+using namespace __gnu_test;
using namespace std;
int
@@ -29,5 +32,6 @@ main()
{
regex re1("a++");
regex re2("(a+)+");
+ VERIFY(regex_match_debug("aa", regex("(a)*{3}")));
return 0;
}
OpenPOWER on IntegriCloud