mclow.lists added inline comments. ================ Comment at: include/regex:5390 @@ -5389,3 +5389,3 @@ size_t __i = *__fmt_first - '0'; - __out = _VSTD::copy(__matches_[__i].first, - __matches_[__i].second, __out); + if (__i < __matches_.size()) { + __out = _VSTD::copy(__matches_[__i].first, ---------------- A better idea. Replace this code: __out = _VSTD::copy(__matches_[__i].first, __matches_[__i].second, __out); with: __out = _VSTD::copy((*this)[__i].first, (*this)[__i].second, __out);
`match_results::operator[]` already has the logic to do something with out of range indexes. ================ Comment at: include/regex:5444 @@ -5441,3 +5443,3 @@ } - __out = _VSTD::copy(__matches_[__i].first, - __matches_[__i].second, __out); + if (__i < __matches_.size()) { + __out = _VSTD::copy(__matches_[__i].first, ---------------- Same as above. ================ Comment at: test/std/re/re.results/re.results.form/form1.pass.cpp:61 @@ +60,3 @@ + assert(r == out + 54); + assert(std::string(out) == "prefix: ab, match: cdefghi, suffix: jk, m[1]: , m[2]: "); + } ---------------- Keep the tests. http://reviews.llvm.org/D16467 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits