diff options
Diffstat (limited to 'libstdc++-v3/testsuite/28_regex/regression.cc')
-rw-r--r-- | libstdc++-v3/testsuite/28_regex/regression.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/28_regex/regression.cc b/libstdc++-v3/testsuite/28_regex/regression.cc index c9a3402011e..e5aec9ea05d 100644 --- a/libstdc++-v3/testsuite/28_regex/regression.cc +++ b/libstdc++-v3/testsuite/28_regex/regression.cc @@ -48,11 +48,33 @@ test02() VERIFY(std::regex_search("/abcd", rx)); } +// PR libstdc++/78236 +void +test06() +{ + char const s[] = "afoo"; + std::basic_regex<char> r("(f+)"); + { + std::cregex_iterator i(s, s+sizeof(s), r); + std::cregex_iterator j(s, s+sizeof(s), r); + VERIFY(i == j); + } + // The iterator manipulation code must be repeated in the same scope + // to expose the undefined read during the execution of the == + // operator (stack location reuse) + { + std::cregex_iterator i(s, s+sizeof(s), r); + std::cregex_iterator j; + VERIFY(!(i == j)); + } +} + int main() { test01(); test02(); + test06(); return 0; } |