summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2015-01-28 22:22:35 +0000
committerMarshall Clow <mclow.lists@gmail.com>2015-01-28 22:22:35 +0000
commit538fec0e59c72a5a8c8f9a6a53fb1ac3334c6ee8 (patch)
tree7ef53ac7756292eed7be32738620548710aa0d38
parent7684e6e1c2b424729a6b432b27f17fa2a3382cb4 (diff)
downloadbcm5719-llvm-538fec0e59c72a5a8c8f9a6a53fb1ac3334c6ee8.tar.gz
bcm5719-llvm-538fec0e59c72a5a8c8f9a6a53fb1ac3334c6ee8.zip
Fix for PR22061 by K-ballo
llvm-svn: 227384
-rw-r--r--libcxx/include/regex14
-rw-r--r--libcxx/test/std/re/re.results/re.results.acc/index.pass.cpp9
2 files changed, 18 insertions, 5 deletions
diff --git a/libcxx/include/regex b/libcxx/include/regex
index 39e106c4e4c..fb0f7d8c262 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -5601,12 +5601,17 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
__node* __st = __start_.get();
if (__st)
{
+ sub_match<const _CharT*> __unmatched;
+ __unmatched.first = __last;
+ __unmatched.second = __last;
+ __unmatched.matched = false;
+
__states.push_back(__state());
__states.back().__do_ = 0;
__states.back().__first_ = __first;
__states.back().__current_ = __first;
__states.back().__last_ = __last;
- __states.back().__sub_matches_.resize(mark_count());
+ __states.back().__sub_matches_.resize(mark_count(), __unmatched);
__states.back().__loop_data_.resize(__loop_count());
__states.back().__node_ = __st;
__states.back().__flags_ = __flags;
@@ -5746,12 +5751,17 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
__node* __st = __start_.get();
if (__st)
{
+ sub_match<const _CharT*> __unmatched;
+ __unmatched.first = __last;
+ __unmatched.second = __last;
+ __unmatched.matched = false;
+
__states.push_back(__state());
__states.back().__do_ = 0;
__states.back().__first_ = __first;
__states.back().__current_ = __first;
__states.back().__last_ = __last;
- __states.back().__sub_matches_.resize(mark_count());
+ __states.back().__sub_matches_.resize(mark_count(), __unmatched);
__states.back().__loop_data_.resize(__loop_count());
__states.back().__node_ = __st;
__states.back().__flags_ = __flags;
diff --git a/libcxx/test/std/re/re.results/re.results.acc/index.pass.cpp b/libcxx/test/std/re/re.results/re.results.acc/index.pass.cpp
index b798969c288..79d4b9a2378 100644
--- a/libcxx/test/std/re/re.results/re.results.acc/index.pass.cpp
+++ b/libcxx/test/std/re/re.results/re.results.acc/index.pass.cpp
@@ -17,11 +17,13 @@
#include <cassert>
void
-test()
+test(std::regex_constants::syntax_option_type syntax)
{
std::match_results<const char*> m;
const char s[] = "abcdefghijk";
- assert(std::regex_search(s, m, std::regex("cd((e)fg)hi")));
+ assert(std::regex_search(s, m, std::regex("cd((e)fg)hi|(z)", syntax)));
+
+ assert(m.size() == 4);
assert(m[0].first == s+2);
assert(m[0].second == s+9);
@@ -46,5 +48,6 @@ test()
int main()
{
- test();
+ test(std::regex_constants::ECMAScript);
+ test(std::regex_constants::extended);
}
OpenPOWER on IntegriCloud