From 482117409dbc2ff30ace1d760c4a5711444c2e38 Mon Sep 17 00:00:00 2001 From: timshen Date: Tue, 15 Dec 2015 04:50:29 +0000 Subject: PR libstdc++/68863 * include/bits/regex_executor.tcc (_Executor::_M_lookahead): Copy the captured content for lookahead, so that the backreferences inside can refer to them. * testsuite/28_regex/algorithms/regex_match/ecma/char/68863.cc: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231641 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/include/bits/regex_executor.tcc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libstdc++-v3/include') diff --git a/libstdc++-v3/include/bits/regex_executor.tcc b/libstdc++-v3/include/bits/regex_executor.tcc index a13f0d54249..f5be4d7cc06 100644 --- a/libstdc++-v3/include/bits/regex_executor.tcc +++ b/libstdc++-v3/include/bits/regex_executor.tcc @@ -147,7 +147,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION bool _Executor<_BiIter, _Alloc, _TraitsT, __dfs_mode>:: _M_lookahead(_StateIdT __next) { - _ResultsVec __what(_M_cur_results.size()); + // Backreferences may refer to captured content. + // We may want to make this faster by not copying, + // but let's not be clever prematurely. + _ResultsVec __what(_M_cur_results); _Executor __sub(_M_current, _M_end, __what, _M_re, _M_flags); __sub._M_states._M_start = __next; if (__sub._M_search_from_first()) -- cgit v1.2.1