]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/28_regex/iterators/regex_iterator/lwg3719.cc
libstdc++: Remove dg-options "-std=gnu++20" from remaining tests
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 28_regex / iterators / regex_iterator / lwg3719.cc
CommitLineData
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
9void
10test_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
25int main()
26{
27 test_iter();
28}