]>
Commit | Line | Data |
---|---|---|
db33daa4 JW |
1 | // { dg-do run { target c++20 } } |
2 | ||
3 | #include <regex> | |
4 | #include <iterator> | |
5 | #include <testsuite_hooks.h> | |
6 | ||
7 | // LWG 3719. Directory iterators should be usable with default sentinel | |
8 | ||
9 | void | |
10 | test_iter() | |
11 | { | |
12 | std::sregex_token_iterator r0; | |
13 | VERIFY( r0 == std::default_sentinel ); | |
14 | std::string haystack = "a needle in a haystack"; | |
15 | std::regex needle("needle"); | |
16 | std::sregex_iterator r1(haystack.begin(), haystack.end(), needle); | |
17 | VERIFY( r1 != std::default_sentinel ); | |
18 | ++r1; | |
19 | VERIFY( r1 == std::default_sentinel ); | |
20 | ||
21 | static_assert( noexcept(r0 == std::default_sentinel) ); // GCC extension | |
22 | static_assert( noexcept(r0 != std::default_sentinel) ); // GCC extension | |
23 | } | |
24 | ||
25 | int main() | |
26 | { | |
27 | test_iter(); | |
28 | } |