[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / re / re.grammar / excessive_brace_count.pass.cpp
blob6ed2645be89b59641c36cdb6c3d42e01776134ec
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // <regex>
10 // UNSUPPORTED: no-exceptions
11 // UNSUPPORTED: c++03
13 // the "n" in `a{n}` should be within the numeric limits.
15 #include <regex>
16 #include <cassert>
17 #include "test_macros.h"
19 int main(int, char**) {
20 for (std::regex_constants::syntax_option_type op :
21 {std::regex::basic, std::regex::grep}) {
22 try {
23 TEST_IGNORE_NODISCARD std::regex("a\\{100000000000000000\\}", op);
24 assert(false);
25 } catch (const std::regex_error &e) {
26 assert(e.code() == std::regex_constants::error_badbrace);
29 for (std::regex_constants::syntax_option_type op :
30 {std::regex::ECMAScript, std::regex::extended, std::regex::egrep,
31 std::regex::awk}) {
32 try {
33 TEST_IGNORE_NODISCARD std::regex("a{100000000000000000}", op);
34 assert(false);
35 } catch (const std::regex_error &e) {
36 assert(e.code() == std::regex_constants::error_badbrace);
39 return 0;