| 1 |
// { dg-do run { target c++11 } } |
| 2 |
// { dg-timeout-factor 2 } |
| 3 |
#include <regex> |
| 4 |
#include <testsuite_iterators.h> |
| 5 |
#include <testsuite_hooks.h> |
| 6 |
|
| 7 |
void |
| 8 |
test01() |
| 9 |
{ |
| 10 |
signed char s[] = { 'a', '.' }; |
| 11 |
std::regex re(s, s+2); // This used to fail up to GCC 11.2 |
| 12 |
// VERIFY( regex_match("an", re) ); |
| 13 |
|
| 14 |
std::wstring str = L"xx"; |
| 15 |
str[0] = '1'; |
| 16 |
str[1] = '2'; |
| 17 |
re.assign(str.begin(), str.end()); |
| 18 |
VERIFY( regex_match("12", re) ); |
| 19 |
} |
| 20 |
|
| 21 |
void |
| 22 |
test02() |
| 23 |
{ |
| 24 |
int i[] = { 'a', '.', '[', 'x', 'y', 'z', ']' }; |
| 25 |
__gnu_test::forward_container<int> fwd(i); |
| 26 |
std::regex re(fwd.begin(), fwd.end()); |
| 27 |
VERIFY( regex_match("any", re) ); |
| 28 |
|
| 29 |
__gnu_test::input_container<int> input(i); |
| 30 |
re.assign(input.begin(), input.end(), std::regex::icase); |
| 31 |
VERIFY( regex_match("ANY", re) ); |
| 32 |
} |
| 33 |
|
| 34 |
int main() |
| 35 |
{ |
| 36 |
test01(); |
| 37 |
test02(); |
| 38 |
} |