xref: /llvm-project/libcxx/test/std/re/re.regex/re.regex.construct/deduct.verify.cpp (revision 9c4a716c1292096fcbdf415b63b7b0122b03310f)
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 // UNSUPPORTED: c++03, c++11, c++14
11 
12 // template<class ForwardIterator>
13 // basic_regex(ForwardIterator, ForwardIterator,
14 //             regex_constants::syntax_option_type = regex_constants::ECMAScript)
15 // -> basic_regex<typename iterator_traits<ForwardIterator>::value_type>;
16 
17 #include <regex>
18 #include <string>
19 #include <iterator>
20 #include <cassert>
21 #include <cstddef>
22 
23 
main(int,char **)24 int main(int, char**)
25 {
26     // Test the explicit deduction guides
27     {
28     // basic_regex(ForwardIterator, ForwardIterator)
29     // <int> is not an iterator
30     std::basic_regex re(23, 34);   // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}basic_regex'}}
31     }
32 
33     {
34     // basic_regex(ForwardIterator, ForwardIterator, flag_type)
35     // <double> is not an iterator
36     std::basic_regex re(23.0, 34.0, std::regex_constants::basic);   // expected-error-re {{no viable constructor or deduction guide for deduction of template arguments of '{{(std::)?}}basic_regex'}}
37     }
38 
39     return 0;
40 }
41