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//===----------------------------------------------------------------------===//
8
9// <regex>
10
11// class regex_iterator<BidirectionalIterator, charT, traits>
12
13// regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b,
14// const regex_type&& re,
15// initializer_list<int> submatches,
16// regex_constants::match_flag_type m =
17// regex_constants::match_default);
18
19#include <regex>
20#include <cassert>
21#include "test_macros.h"
22
23#if TEST_STD_VER < 14
24#error
25#endif
26
27int main(int, char**)
28{
29 {
30 std::regex phone_numbers("\\d{3}-(\\d{4})");
31 const char phone_book[] = "start 555-1234, 555-2345, 555-3456 end";
32 std::cregex_token_iterator i(std::begin(arr: phone_book), std::end(arr: phone_book)-1,
33 std::regex("\\d{3}-\\d{4}"), {-1, 0, 1});
34 }
35
36 return 0;
37}
38

source code of libcxx/test/std/re/re.iter/re.tokiter/re.tokiter.cnstr/init.compile.fail.cpp