| 1 |
// { dg-do run { target c++11 } } |
| 2 |
#include <regex> |
| 3 |
#include <testsuite_hooks.h> |
| 4 |
|
| 5 |
void |
| 6 |
test01() |
| 7 |
{ |
| 8 |
std::regex re{""}; |
| 9 |
VERIFY( re.flags() & std::regex::ECMAScript ); |
| 10 |
|
| 11 |
std::regex re2{"", std::regex::flag_type{}}; |
| 12 |
VERIFY( re2.flags() == std::regex::flag_type() ); // See also PR 83598 |
| 13 |
} |
| 14 |
|
| 15 |
void |
| 16 |
test02() |
| 17 |
{ |
| 18 |
// A valid value of type syntax_option_type shall have at most one of the |
| 19 |
// grammar elements ECMAScript, basic, extended, awk, grep, egrep, set. |
| 20 |
|
| 21 |
try |
| 22 |
{ |
| 23 |
std::regex{"", std::regex::ECMAScript|std::regex::basic}; |
| 24 |
VERIFY( false ); |
| 25 |
} |
| 26 |
catch (const std::regex_error&) |
| 27 |
{ |
| 28 |
} |
| 29 |
|
| 30 |
try |
| 31 |
{ |
| 32 |
std::regex{"", std::regex::extended|std::regex::basic}; |
| 33 |
VERIFY( false ); |
| 34 |
} |
| 35 |
catch (const std::regex_error&) |
| 36 |
{ |
| 37 |
} |
| 38 |
|
| 39 |
try |
| 40 |
{ |
| 41 |
std::regex{"", std::regex::grep|std::regex::basic}; |
| 42 |
VERIFY( false ); |
| 43 |
} |
| 44 |
catch (const std::regex_error&) |
| 45 |
{ |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
int main() |
| 50 |
{ |
| 51 |
test01(); |
| 52 |
test02(); |
| 53 |
} |