]>
Commit | Line | Data |
---|---|---|
99dee823 | 1 | // Copyright (C) 2017-2021 Free Software Foundation, Inc. |
bfd88d1d JW |
2 | // |
3 | // This file is part of the GNU ISO C++ Library. This library is free | |
4 | // software; you can redistribute it and/or modify it under the | |
5 | // terms of the GNU General Public License as published by the | |
6 | // Free Software Foundation; either version 3, or (at your option) | |
7 | // any later version. | |
8 | ||
9 | // This library is distributed in the hope that it will be useful, | |
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | // GNU General Public License for more details. | |
13 | ||
14 | // You should have received a copy of the GNU General Public License along | |
15 | // with this library; see the file COPYING3. If not see | |
16 | // <http://www.gnu.org/licenses/>. | |
17 | ||
18 | // { dg-options "-std=gnu++17" } | |
7b936140 | 19 | // { dg-do compile { target c++17 } } |
218cedd5 | 20 | // { dg-timeout-factor 3 } |
bfd88d1d JW |
21 | |
22 | #include <regex> | |
23 | #include <testsuite_iterators.h> | |
24 | ||
25 | template<typename T, typename U> struct require_same; | |
26 | template<typename T> struct require_same<T, T> { using type = void; }; | |
27 | ||
28 | template<typename T, typename U> | |
29 | typename require_same<T, U>::type | |
30 | check_type(U&) { } | |
31 | ||
32 | void | |
33 | test01() | |
34 | { | |
35 | std::basic_regex x(""); | |
36 | check_type<std::basic_regex<char>>(x); | |
37 | char s[1] = {}; | |
38 | std::basic_regex x2(s); | |
39 | check_type<std::basic_regex<char>>(x2); | |
40 | std::basic_regex x3(U""); | |
41 | check_type<std::basic_regex<char32_t>>(x3); | |
42 | std::basic_regex x4(U"", std::regex_constants::grep); | |
43 | check_type<std::basic_regex<char32_t>>(x4); | |
44 | ||
45 | // Test explicit guide: | |
46 | std::basic_regex x5(s, s+1); | |
47 | check_type<std::basic_regex<char>>(x5); | |
48 | std::basic_regex x6((const char*)s, (const char*)s+1); | |
49 | check_type<std::basic_regex<char>>(x6); | |
50 | std::basic_regex x7(s, s+1, std::regex_constants::grep); | |
51 | check_type<std::basic_regex<char>>(x7); | |
52 | __gnu_test::test_container<char, __gnu_test::forward_iterator_wrapper> f(s); | |
53 | std::basic_regex x8(f.begin(), f.end()); | |
54 | check_type<std::basic_regex<char>>(x8); | |
55 | std::basic_regex x9(f.begin(), f.end(), std::regex_constants::grep); | |
56 | check_type<std::basic_regex<char>>(x9); | |
57 | ||
58 | std::basic_regex copy = x; | |
59 | check_type<std::basic_regex<char>>(copy); | |
60 | std::basic_regex move = std::move(x); | |
61 | check_type<std::basic_regex<char>>(move); | |
62 | } |