[PATCH] [libcxx] Fix match_results for alternatives

Agustín Bergé kaballo86 at hotmail.com
Sat Jan 24 16:40:09 PST 2015


================
Comment at: test/std/re/re.results/re.results.acc/index.pass.cpp:26
@@ -25,3 +25,3 @@
 
     assert(m[0].first == s+2);
     assert(m[0].second == s+9);
----------------
mclow.lists wrote:
> Ok, then I'm really confused.
> 
> The code for `match_results::operator[]` is:
>      return __n < __matches_.size() ? __matches_[__n] : __unmatched_;
> 
> So how does the change in `<regex>` affect this result?
The changes affect unmatched alternative subexpressions. Consider instead the expression `"(z)|cd((e)fg)hi"`, the `(z)` subexpression would then be `m[1]` instead of `m[3]`. In both cases the subscript is within range, so the out-of-range `__unmatched_` result is not referenced.

http://reviews.llvm.org/D7111

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list