blob: 5d8d48d0590da3580861c9ef196002b81432c81c [file] [log] [blame]
Howard Hinnant8c2c18d2010-06-24 21:28:00 +00001//===----------------------------------------------------------------------===//
2//
Chandler Carruth7c3769d2019-01-19 10:56:40 +00003// 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
Howard Hinnant8c2c18d2010-06-24 21:28:00 +00006//
7//===----------------------------------------------------------------------===//
8
9// <regex>
10
11// template <class charT, class traits = regex_traits<charT>>
12// class basic_regex
13// {
14// public:
15// // constants:
16// static constexpr regex_constants::syntax_option_type icase = regex_constants::icase;
17// static constexpr regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
18// static constexpr regex_constants::syntax_option_type optimize = regex_constants::optimize;
19// static constexpr regex_constants::syntax_option_type collate = regex_constants::collate;
20// static constexpr regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
21// static constexpr regex_constants::syntax_option_type basic = regex_constants::basic;
22// static constexpr regex_constants::syntax_option_type extended = regex_constants::extended;
23// static constexpr regex_constants::syntax_option_type awk = regex_constants::awk;
24// static constexpr regex_constants::syntax_option_type grep = regex_constants::grep;
25// static constexpr regex_constants::syntax_option_type egrep = regex_constants::egrep;
26
27#include <regex>
28#include <type_traits>
Marshall Clow6dfff1c2016-04-26 16:24:44 +000029#include "test_macros.h"
Howard Hinnant8c2c18d2010-06-24 21:28:00 +000030
Stephan T. Lavavej302557b2017-08-11 20:53:53 +000031template <class T>
32void where(const T &) {}
Howard Hinnant0a69fa12012-12-12 21:14:28 +000033
Howard Hinnant8c2c18d2010-06-24 21:28:00 +000034template <class CharT>
35void
36test()
37{
38 typedef std::basic_regex<CharT> BR;
39 static_assert((BR::icase == std::regex_constants::icase), "");
40 static_assert((BR::nosubs == std::regex_constants::nosubs), "");
41 static_assert((BR::optimize == std::regex_constants::optimize), "");
42 static_assert((BR::collate == std::regex_constants::collate), "");
43 static_assert((BR::ECMAScript == std::regex_constants::ECMAScript), "");
44 static_assert((BR::basic == std::regex_constants::basic), "");
45 static_assert((BR::extended == std::regex_constants::extended), "");
46 static_assert((BR::awk == std::regex_constants::awk), "");
47 static_assert((BR::grep == std::regex_constants::grep), "");
48 static_assert((BR::egrep == std::regex_constants::egrep), "");
Howard Hinnant0a69fa12012-12-12 21:14:28 +000049 where(BR::icase);
50 where(BR::nosubs);
51 where(BR::optimize);
52 where(BR::collate);
53 where(BR::ECMAScript);
54 where(BR::basic);
55 where(BR::extended);
56 where(BR::awk);
57 where(BR::grep);
58 where(BR::egrep);
Howard Hinnant8c2c18d2010-06-24 21:28:00 +000059}
60
JF Bastiene15dd4e2019-02-04 20:31:13 +000061int main(int, char**)
Howard Hinnant8c2c18d2010-06-24 21:28:00 +000062{
63 test<char>();
64 test<wchar_t>();
JF Bastiene15dd4e2019-02-04 20:31:13 +000065
66 return 0;
Howard Hinnant8c2c18d2010-06-24 21:28:00 +000067}